Friday, December 14, 2007

configure your Rails application to send email messages

Add the following code to config/environment.rb:

ActionMailer::Base.server_settings = {
:address => "mail.yourhostingcompany.com",
:port => 25,
:domain => "www.yourwebsite.com",
:authentication => :login,
:user_name => "username",
:password => "password"
}


Replace each hash value with proper settings for your Simple Mail Transfer Protocol (SMTP) server.

You may also change the default email message format. If you prefer to send email in HTML instead of plain text format, add the following line to config/environment.rb as well:

ActionMailer::Base.default_content_type = "text/html"


Possible values for ActionMailer::Base.default_content_type are "text/plain", "text/html", and "text/enriched". The default value is "text/plain".

No comments: