This is from an older version of rails, probably still works, not the
cleanest code either:
require ''action_mailer''
require ''digest/sha1''
class ApplicationMailer < ActionMailer::Base
@@template_root = "../app/email_templates"
def verify_notification(user)
@recipients = user.email_address
@subject = "Account Created"
@body["first_name"] = user.first_name
@body["last_name"] = user.last_name
@body["validation_key"] =
user.validation_keys.build(''validation_key'' =>
Digest::SHA1.hexdigest(rand.to_s),
''date_created'' =>
Time.now())
@body["validation_key"].save
@from =
''webmaster-9IKiO1iGCm/QT0dZR+AlfA@public.gmane.org''
end
end
Then I call:
ApplicationMailer.deliver_verify_notification(@user)
----- Original Message -----
From: "Nathan Wright"
<nathan-t2/9jZt1M8BPjb27YXYYTQ@public.gmane.org>
To: "Ruby on Rails"
<rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org>
Sent: Thursday, March 10, 2005 2:20 PM
Subject: [Rails] ActionMailer examples?
> Does anyone have a simple, working example of a project that uses
> ActionMailer that they''d like to share. So far I''ve been
completely unable
> to get anything with ActionMailer to work ...
>
> --
> Nathan Wright
> http://www.brandalism.com
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails