Rails mailer throws no error, but email doesn't arrive

Joe Morano

My Rails mailer worked perfectly a few months ago. I didn't deal with it for a long time, and I don't remember changing anything either. But now, no email is sent when I activate the mailer via my console, although I don't receive any errors.

I triple-checked that the email addresses and passwords are correct. I also set up my email according to this answer. But no emails are sent. If something is going wrong, shouldn't I at least be getting an error in my console?

I'm using Rails 4.0.10.

config/environments/development.rb

Website::Application.configure do
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { host:'localhost', port: '3000' }
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.default :charset => "utf-8"
  config.action_mailer.smtp_settings = {
    address: 'smtp.gmail.com',
    port: 587,
    domain: 'localhost:3000',
    user_name: 'xxxxxx@xxxxxxx',
    password: 'password',
    authentication: 'plain',
    enable_starttls_auto: true
  }
end

app/mailers/user_mailer

class UserMailer < ActionMailer::Base
  default from: "xxxxxx@xxxxx"

  def notify(user)
    @user = user
    mail(to: @user.email,subject: "subject")
  end
end

Console

$ UserMailer.notify(User.first)
 Rendered user_mailer/notify.html.erb (0.4ms)
=> #<Mail::Message:2623523, Multipart: false, Headers: <From: xxxxxx@xxxxx>, <To: xxxxxxx@xxxxx>, <Subject: subject>, <Mime-Version: 1.0>, <Content-Type: text/html>> 
Prashant4224

Use Mailer methods deliver,deliver_now or deliver_later in your controller or Model

UserMailer.notify(User.first).deliver

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Zip file doesn't arrive when attached to email

From Dev

Email from Google App Engine doesn't arrive

From Dev

Rails 4 Mailer not sending email

From Dev

action mailer error to deliver email

From Dev

(Rails) update_attributes throws error (needing a password) during integration test that doesn't use password

From Dev

Rails mailer: generating an email without a user model

From Dev

Rails mailer error with inline attachment

From Dev

mailer doesn't launch in ios

From Dev

Email 'email_calendar' not found in CalendarMailerPreview Rails Mailer Preview

From Dev

Why doesn't Gmail let me modify :from field Rails action mailer

From Dev

Rails 4.2 Mailer Problems - Can't get mailer to work

From Dev

ng-show="frm.Email.$error.email " doesn't show the error of invalid email

From Dev

Ruby on Rails Omniauth facebook doesn't return email

From Dev

Rails4 template error in mailer in production

From Dev

how to pass multiple objects into mailer/email contents in rails

From Dev

How can we set the name of the email sender in Rails Mailer?

From Dev

Store mailer class and method after email sent in rails

From Dev

Is it possible to replace default from: with an email from database in Rails Action Mailer?

From Dev

Rails 4: Getting QRCode to display in email via action mailer

From Dev

Rails 4: Getting QRCode to display in email via action mailer

From Dev

How to display image in email using action mailer in ruby on rails

From Dev

JWPlayer (new version) throws an error and doesn't play on the site

From Dev

Signing in using FirebaseUI doesn't back out of webview and throws error

From Dev

Why SimpleDateFormat setTimeZone doesn't throws error for invalid timezone

From Dev

Nginx rewrite rule doesn't work, throws 404 error

From Dev

JavaScript throws an error - Code in a loop doesn't work

From Dev

PHP mailer throws error in php 7 when tried send mail

From Dev

Rails in production throws 502 error

From Dev

CodeRay throws error in Rails console

Related Related

  1. 1

    Zip file doesn't arrive when attached to email

  2. 2

    Email from Google App Engine doesn't arrive

  3. 3

    Rails 4 Mailer not sending email

  4. 4

    action mailer error to deliver email

  5. 5

    (Rails) update_attributes throws error (needing a password) during integration test that doesn't use password

  6. 6

    Rails mailer: generating an email without a user model

  7. 7

    Rails mailer error with inline attachment

  8. 8

    mailer doesn't launch in ios

  9. 9

    Email 'email_calendar' not found in CalendarMailerPreview Rails Mailer Preview

  10. 10

    Why doesn't Gmail let me modify :from field Rails action mailer

  11. 11

    Rails 4.2 Mailer Problems - Can't get mailer to work

  12. 12

    ng-show="frm.Email.$error.email " doesn't show the error of invalid email

  13. 13

    Ruby on Rails Omniauth facebook doesn't return email

  14. 14

    Rails4 template error in mailer in production

  15. 15

    how to pass multiple objects into mailer/email contents in rails

  16. 16

    How can we set the name of the email sender in Rails Mailer?

  17. 17

    Store mailer class and method after email sent in rails

  18. 18

    Is it possible to replace default from: with an email from database in Rails Action Mailer?

  19. 19

    Rails 4: Getting QRCode to display in email via action mailer

  20. 20

    Rails 4: Getting QRCode to display in email via action mailer

  21. 21

    How to display image in email using action mailer in ruby on rails

  22. 22

    JWPlayer (new version) throws an error and doesn't play on the site

  23. 23

    Signing in using FirebaseUI doesn't back out of webview and throws error

  24. 24

    Why SimpleDateFormat setTimeZone doesn't throws error for invalid timezone

  25. 25

    Nginx rewrite rule doesn't work, throws 404 error

  26. 26

    JavaScript throws an error - Code in a loop doesn't work

  27. 27

    PHP mailer throws error in php 7 when tried send mail

  28. 28

    Rails in production throws 502 error

  29. 29

    CodeRay throws error in Rails console

HotTag

Archive