2

I am trying to send emails while being on localhost and using devise (I need emails for user registration and password reset)

I have put this in my environment.rb file

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
    address: "smtp.gmail.com",
    port: 587,
    domain: "gmail.com",
    authentication: "plain",
    enable_starttls_auto: true,
    user_name: ENV["username"],
    password: ENV["password"]

}

config.action_mailer.default_url_options = { :host => 'localhost:3000' }

but I am not getting any mails and not seeing any error too (devise says ).

  • What am I missing ?
  • Where can I see the log for emails (success or failure) ?

EDIT - OK, it worked after adding this line

:openssl_verify_mode  => 'none'

Check this too rails email error - 530-5.5.1 Authentication Required.

Community
  • 1
  • 1
iCyborg
  • 4,699
  • 15
  • 53
  • 84
  • 1
    have you configured `config/initializers/devise.rb` with `config.mailer_sender = ""` . In addition to this, also set `config.action_mailer.raise_delivery_errors = true` to check for any errors – Nishant Jan 16 '13 at 12:06
  • yes, I have added the same email id at config.mailer_sender which I have kept as smtp username, still no email – iCyborg Jan 16 '13 at 13:55
  • 1
    as Nishant has staetd make sure config.action_mailer.raise_delivery_errors = true otherwise you wont see any errors. are there any problems with your ENV variables, though would be better to place them in a yml file and load them when initializing.. – Richlewis Jan 16 '13 at 13:57
  • @Richlewis - Rich, I have set it as true and I am seeing "You will receive an email with instructions ..." message rather then some error, still not getting any email – iCyborg Jan 16 '13 at 14:07
  • ok, have you checked your spam folder, this sometimes happens with gmail – Richlewis Jan 16 '13 at 14:14
  • and to clarify config.mailer_sender = "your gmail address" – Richlewis Jan 16 '13 at 14:15
  • @Richlewis - Thanks Rich, I solved the problem, I had to add ":openssl_verify_mode => 'none'" too. I got it from http://stackoverflow.com/questions/11724906/rails-email-error-530-5-5-1-authentication-required/11725153#11725153, – iCyborg Jan 16 '13 at 15:03
  • glad you got it working though have never heard of or used that option before – Richlewis Jan 16 '13 at 15:24
  • @Nishant not my question and I didnt solve it, think you meant to post this to iCyborg – Richlewis Jan 17 '13 at 09:03
  • @iCyborg Would be better, if you post the part that worked as an answer instead of an edit to the question and accept your own answer. – Nishant Jan 17 '13 at 09:05
  • @Richlewis :) deleted that one. and addressed to icyborg – Nishant Jan 17 '13 at 09:05

0 Answers0