Rails Cookbook (Cookbooks (OReilly))
Problem
Contributed by: Dae San Hwang You want to configure your Rails application to send email messages. Solution
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". Discussion
ActionMailer::Base.server_settings is a hash object containing configuration parameters to connect to the SMTP server. Here's what each parameter does:
Action Mailer does not support SMTP over TLS or SSL as of version 1.2.1. See Also
|
Категории