rails send email code example
Example 1: rails send test email
ActionMailer::Base.mail(
from: "[email protected]",
to: "[email protected]",
subject: "Test",
body: "Test"
).deliver_now
Example 2: rails send email from console
ActionMailer::Base.mail(
from: "[email protected]",
to: "[email protected]",
subject: "Test",
body: "Test"
).deliver_now
Example 3: ruby on rails send activate mail
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'example.com',
user_name: '<username>',
password: '<password>',
authentication: 'plain',
enable_starttls_auto: true }