Forum: Ruby on Rails ActionMailer: Mail isn't delivered

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fc582698581884352e745d1d4c64699d?d=identicon&s=25 Joshua Muheim (josh)
on 2006-01-24 15:37
Hi all

I used the search for this, but I got an Application Error, so sorry for
the newbie question.

I have tried to send an e-mail using ActionMailer. I have to following
config (environment.rb):

ActionMailer::Base.server_settings = {
  :address => "mail.psyguide.org",
  :port => 25,
  :domain => "mail.psyguide.org",
  #:authentication => :login,
  #:user_name => "dave",
  #:password => "secret",
}
ActionMailer::Base.default_charset = "utf-8"

The mail seems to be sent without any problem, and in the log file I
can't figure out any problem. But the e-mail just doesn't arrive... How
can I debug this problem?

Thanks for help.
Josh
F15fdc7cb2e911b3808837f2be244add?d=identicon&s=25 Adam Denenberg (Guest)
on 2006-01-24 15:45
(Received via mailing list)
did you check the logs of your mailserver ?
Fc582698581884352e745d1d4c64699d?d=identicon&s=25 Joshua Muheim (josh)
on 2006-01-24 16:00
Adam Denenberg wrote:
> did you check the logs of your mailserver ?

Hrm don't know where I could do that. Wrote an e-mail to the support of
my webspace.
Is there another way to debug? Shouldn't I have the possibility somehow
to detect within Rails whether the e-mail was sent successfully or not
and then throw an exception if needed...?
Ddd318eb14b80b5b048a4adc1901e68e?d=identicon&s=25 Alexander Peretti (alexp)
on 2006-01-24 16:06
Its weird I'm actually having the exact same problem right now. I have
no idea how you would check your logs.

In your code above, have you tried changing the domain to psyguide.org
and not mail.psyguide.org?
5c19f2d52879a1e10670c7334ba4c7e3?d=identicon&s=25 Lugovoi Nikolai (Guest)
on 2006-01-24 16:06
(Received via mailing list)
2006/1/24, Joshua Muheim <forum@josh.ch>:
> ....

1. You can explicitly enforce some rules (in environment.rb):
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true

and send email (using ActionMailer), say, to  your own email address.
(Maybe problem isn't ActionMailer, but mailserver?)

2. Run in development environment, so if you get Application Error you
can trace down where it happens and debug if needed

HTH
Ddd318eb14b80b5b048a4adc1901e68e?d=identicon&s=25 Alexander Peretti (alexp)
on 2006-01-24 16:16
Lugovoi Nikolai wrote:
> 2006/1/24, Joshua Muheim <forum@josh.ch>:
>> ....
>
> 1. You can explicitly enforce some rules (in environment.rb):
> ActionMailer::Base.delivery_method = :smtp
> ActionMailer::Base.perform_deliveries = true
> ActionMailer::Base.raise_delivery_errors = true
>
> and send email (using ActionMailer), say, to  your own email address.
> (Maybe problem isn't ActionMailer, but mailserver?)
>
> 2. Run in development environment, so if you get Application Error you
> can trace down where it happens and debug if needed
>
> HTH

If I add those to environment.rb I get a big ass error

Net::SMTPSyntaxError in Email#confirm
502 Error: command not implemented
Fc582698581884352e745d1d4c64699d?d=identicon&s=25 Joshua Muheim (josh)
on 2006-01-24 16:17
Thanks, I got the error that the e-mail webmaster@psyguide.org doesn't
exist (which is correct). I changed it to a correct e-mail, and now it
works. Thanks a lot! :-)

Btw. what should be the correct settings for a productive environment?
There I don't want to see the user such warnings...
Ddd318eb14b80b5b048a4adc1901e68e?d=identicon&s=25 Alexander Peretti (alexp)
on 2006-01-24 16:21
Joshua Muheim wrote:
> Thanks, I got the error that the e-mail webmaster@psyguide.org doesn't
> exist (which is correct). I changed it to a correct e-mail, and now it
> works. Thanks a lot! :-)
>
> Btw. what should be the correct settings for a productive environment?
> There I don't want to see the user such warnings...

I'm glad you found the problem.

I'm getting this error
502 Error: command not implemented
RAILS_ROOT: /Users/alexp/Sites/pulse/script/../config/..
Application Trace | Framework Trace | Full Trace
/usr/lib/ruby/1.8/net/smtp.rb:680:in `check_response'
/usr/lib/ruby/1.8/net/smtp.rb:582:in `auth_login'
/usr/lib/ruby/1.8/net/smtp.rb:581:in `critical'
/usr/lib/ruby/1.8/net/smtp.rb:581:in `auth_login'
/usr/lib/ruby/1.8/net/smtp.rb:571:in `__send__'
/usr/lib/ruby/1.8/net/smtp.rb:571:in `authenticate'
/usr/lib/ruby/1.8/net/smtp.rb:411:in `do_start'
/usr/lib/ruby/1.8/net/smtp.rb:378:in `start'
/usr/lib/ruby/1.8/net/smtp.rb:316:in `start'
...

Does that mean my code is wrong or the smtp settings?
5c19f2d52879a1e10670c7334ba4c7e3?d=identicon&s=25 Lugovoi Nikolai (Guest)
on 2006-01-24 16:36
(Received via mailing list)
2006/1/24, Alexander Peretti <alex.peretti@pulsedev.net>:
> I'm getting this error
> 502 Error: command not implemented

These are really essential points, thanks for providing:
> /usr/lib/ruby/1.8/net/smtp.rb:582:in `auth_login'
> /usr/lib/ruby/1.8/net/smtp.rb:571:in `authenticate'

So, it's your SMTP server that says it can't handle command AUTH LOGIN

> Does that mean my code is wrong or the smtp settings?
>

Try to change in environment.rb:
ActionMailer::Base.server_settings = {
... # here go your server settings
:authentication => :plain #or omit this line if your server doesn't
require authentication
}

Hint: you can check your SMTP sever via telnet (google a little about
SMTP command and telnet use :)

HTH
Ddd318eb14b80b5b048a4adc1901e68e?d=identicon&s=25 Alexander Peretti (alexp)
on 2006-01-24 17:39
Yep I tried all that earlier
This topic is locked and can not be replied to.