4

Action Mailer is configured as follows in development.rb:

config.action_mailer.delivery_method       = :sendmail
config.action_mailer.perform_deliveries    = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options   = { :host => 'localhost:3000' }

That is supposed to work according to Rails Guides and all extra info I managed to find on the internet. When I searched for my specific problem I mostly found solutions for SMTP configurations.

What am I missing?

Update:

All my emails are being delivered to /var/mail/root for some reason.

Matheus Moreira
  • 17,106
  • 3
  • 68
  • 107

2 Answers2

8

On your development machine do you have the program 'sendmail' installed? Try this on the command line:

which sendmail

If I were you I'd not be sending email in development mode, but if you do want to do that, sign up for a gmail.com account and use this:

config.action_mailer.delivery_method = :smtp

config.action_mailer.smtp_settings = {
  :enable_starttls_auto => true,
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => "gmail.com",
  :authentication => :login,
  :user_name => "<your username>@gmail.com",
  :password => "<your password>",
}
stef
  • 14,172
  • 2
  • 48
  • 70
  • Yes, sendmail is present on my machine; `which sendmail` outputs `/usr/sbin/sendmail`. I did read about Action Mailer's `deliveries` array. How do I use it in development? – Matheus Moreira Jan 02 '11 at 18:37
  • It might not be because of the config - what does the send code look like? And what is in /var/log/mail.log ? – stef Jan 02 '11 at 18:58
  • `/var/mail/root` is indeed stuffed full of confirmation emails. How they ended up there is beyond me... – Matheus Moreira Jan 02 '11 at 19:08
  • I think I isolated the problem: I was using a Hotmail account to register and it turns out Hotmail doesn't like dynamic IP addresses. Is adopting an external SMTP server the only way around this? – Matheus Moreira Jan 02 '11 at 19:51
  • 1
    Ah yes - you wouldn't have a Sender Policy Framework. Take a look at http://sendgrid.com and use SMTP. – stef Jan 03 '11 at 08:55
  • 1
    is there a way to encrypt the password? – scientiffic Apr 16 '13 at 17:40
  • 2
    @scientiffic normally I would put the password in environment variables on the production server and in a foreman .env file in my repo. If you're storing it somewhere untrusted you could use https://github.com/mdp/gibberish to encrypt/decrypt – stef Apr 17 '13 at 06:33
0

can't be the some domain where use the sendmail
so change the config in devise.rb

config.mailer_sender = "no-reply@other-domain.com"

check mail log below

tail -f /var/log/mail.log 

good luck

jiahut
  • 1,451
  • 15
  • 14