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.
Joshua M. (Guest)
on 2006-01-24 16: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
Adam D. (Guest)
on 2006-01-24 16:45
(Received via mailing list)
did you check the logs of your mailserver ?
Joshua M. (Guest)
on 2006-01-24 17:00
Adam D. 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...?
Alexander P. (Guest)
on 2006-01-24 17: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?
Lugovoi N. (Guest)
on 2006-01-24 17:06
(Received via mailing list)
2006/1/24, Joshua M. <removed_email_address@domain.invalid>:
> ....

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
Alexander P. (Guest)
on 2006-01-24 17:16
Lugovoi N. wrote:
> 2006/1/24, Joshua M. <removed_email_address@domain.invalid>:
>> ....
>
> 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
Joshua M. (Guest)
on 2006-01-24 17:17
Thanks, I got the error that the e-mail removed_email_address@domain.invalid 
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...
Alexander P. (Guest)
on 2006-01-24 17:21
Joshua M. wrote:
> Thanks, I got the error that the e-mail removed_email_address@domain.invalid 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?
Lugovoi N. (Guest)
on 2006-01-24 17:36
(Received via mailing list)
2006/1/24, Alexander P. <removed_email_address@domain.invalid>:
> 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
Alexander P. (Guest)
on 2006-01-24 18:39
Yep I tried all that earlier
This topic is locked and can not be replied to.