Welcome Guest | Login

actionmailer - how to set it up?

Hi,

I am really noob at this.

So I want to ask how to set up actionmailer?

I know i need to add this chunk of code to environment.rb

ActionMailer::Base.delivery_method = :sendmail  
ActionMailer::Base.perform_deliveries = true  
ActionMailer::Base.raise_delivery_errors = true  
ActionMailer::Base.default_charset = "utf-8"

but where do i add it?

Do i add it at the end of the file or inside the Rails::Initializer.run do |config|?

Thank you.

2008-01-06 02:58 AM

Hi -  You can add it in the fine config/environment.rb file towards the end. Thank you

2008-01-06 03:20 AM

HostingRails Support
Thanks!

I have some trouble understanding how to code it.

All i have done so far is creat a user_notifier model.

I am not too sure how to carry on with this.
http://technoweenie.stikipad.com/plugins/show/Password+Resetting

and the agile web devt book both use @subject etc to represent the variables but when I look at the apihttp://api.rubyonrails.com/classes/ActionMailer/Base.html

i saw that they no longer use the @ sign.

I am confused.

I am using rails 1.2.6. Please advise.

Thank you.

2008-01-06 03:24 AM

Hi Simone, conceptually the way this works is you have a notifier model with corresponding views for your mails you need to send out.  These model methods are called from controllers (or I suppose views if you really want to) passing the parameters necessary.  The model picks up these parameters and spits them into the view body of the email.

So, what I'd like to see from you is the relevant code in your controller sending the parameters to the notifier model, the method in the notifier model receiving it, and the corresponding view.

If you can paste those in I'm sure we can help you out.

Cheers,
~William

2008-01-06 12:08 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up today!