Let us use GMail SMTP server for testing.
Step 1:
Please include the below code in environment.rb file under /config folder.
# environment.rb
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.default_content_type = "text/html"
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",
:port => "587",
:domain => "localhost",
:authentication => :plain,
:user_name => "google_username",
:password => "google_password",
}
Step 2:
Generate Mailer model using the below command.
ruby script/generate mailer registration
Step 3:
Now your registration.rb model file should like below. Include the method welcome in class Registration.
class Registration < ActionMailer::Base
def welcome(name, email)
@recipients = "user@host.com"
@from = params[:contact][:email]
headers "Reply-to" => "#{email}"
@subject = "Welcome to Add Three"
@sent_on = Time.now
@content_type = "text/html"
body[:name] = name
body[:email] = email
end
end
The Motorcycle Diaries
-
The journey of a man which changed his life forever! What more one could
write about this movie with the preceding line aptly describing the movie?
I fe...