ActionMailer issue

Because you do need to provide these parameters, but I place them in environment.rb (or a specific production/development environment if they differ).

Using Sendmail

ActionMailer::Base.delivery_method = :sendmail

Or normal SMTP

ActionMailer::Base.smtp_settings = {

:address => “127.0.0.1”,

:domain => “mydomain.com”,

:port => 123456789,

:user_name => “myuser”,

:password => “mypassword”,

:authentication => :plain/:login/:cram_md5 (whatever you want to use of these three)

}

Best regards

Peter De Berdt

If understood correctly, I either use :sendmail or SMTP settings.

Correct

My code worked with

config.action_mailer.delivery_method = :smtp

in the Rails::Initializer.run block situated in the environment.rb

and (as you said)

One of the two notations is the preferred one, don’t remember which one.

ActionMailer::Base.delivery_method = :sendmail.

I place this below the Rails::Initializer block.

If I remove these two lines in the environment.rb, that means that I

should write SMTP parameters, right?

Probably yeah. Just try it out :slight_smile:

Best regards

Peter De Berdt

Did you restart your mongrel(s)? Environment is loaded at startup. If you don’t want to send mails in development, there’s a parameter in the environment variables for that too.

Best regards

Peter De Berdt

Agile Web Development with Rails, Second Edition, buy the PDF version and you’ll have all the info you need a few minutes later. You should also check the wiki (and hope the info isn’t outdated): http://wiki.rubyonrails.org/rails/pages/ActionMailer

Best regards

Peter De Berdt

If SMTP server is not specified in environment.rb or helper,
ActionMailer defaults to localhost's smtp agent. That's why the email
still gets sent out. There aren't too many up to date tutorials out
there and with ActionMailer, I found too many subtle changes from
versions.

Good luck!

if you are on textdrive you can send emails without configuring
anything.