Reputation: 755
I have the following in my config/environments/development.rb
# ActionMailer settings
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
user_name: 'gmail account',
password: 'password',
authentication: 'plain',
enable_starttls_auto: true}
I have the following Mailer and method to test sending an email
class EventMailer < ActionMailer::Base
default from: "[email protected]"
def test_email
mail(to: "Me <[email protected]", subject: 'Test email')
end
end
And inside one of my controller methods I have
EventMailer.test_email().deliver
I can see in my terminal the message says it's been sent (I believe this is the log?), but I don't receive any actual email. I'm new to the ActionMailer and was just following the steps on the ruby guides site but it doesn't work. Not sure what I'm leaving out. No errors show up in my terminal when I try it out and I know my smtp_settings are correct because I can send emails using rubys Net::SMTP in my ruby interpreter using the same smtp settings as above. I'm just having trouble getting it to work with ActionMailer. Any help is appreciated!
Upvotes: 2
Views: 3524
Reputation: 755
It was the silliest thing. I just had to restart my local server after I changed the development.rb file >.< gaah
Upvotes: 7