Net::SMTPAuthenticationError

Hey guys,
I want to send an email via ROR and I have put this code at the very end
in the config/environment.rb file-

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.logger = nil
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
  :address => "[my smtp server]",
  :port => 25,
  :domain => '[my domain],
  :authentication => :plain,
  :user_name => 'do-not-reply@example.com',
  :password => '[my password]'
    }

but when i click on send mail button, it shows following error:

  Net::SMTPAuthenticationError in MailingController#sendmail

502 unimplemented (#5.5.1)

RAILS_ROOT: C:/work/2phone
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/1.8/net/smtp.rb:577:in `auth_plain'
c:/ruby/lib/ruby/1.8/net/smtp.rb:571:in `__send__'
c:/ruby/lib/ruby/1.8/net/smtp.rb:571:in `authenticate'
c:/ruby/lib/ruby/1.8/net/smtp.rb:411:in `do_start'
c:/ruby/lib/ruby/1.8/net/smtp.rb:378:in `start'
c:/ruby/lib/ruby/1.8/net/smtp.rb:316:in `start'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:586:in
`perform_delivery_smtp'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:469:in
`__send__'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:469:in
`deliver!'
c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:352:in
`method_missing'
app/controllers/mailing_controller.rb:8:in `sendmail'

Please help me out from this problem, i have got stuck due to this

Please also tell me the requirements for sending mail, if i am missing
something. any gems, settings or ...

This is probably saying that the SMTP server you are trying to send
through doesn't support plain authentication.

Find out what types of authentication your SMTP server supports, this will help.

Mikel

Mikel Lindsaar wrote:

What Authentication type should be there for sending an email?

When I changed the type of :authentication in config/environment.rb file, :plain to :cram_md5 now it showed me this error:

Net::SMTPSyntaxError in MailingController#sendmail

502 unimplemented (#5.5.1)

RAILS_ROOT: C:/work/2phone
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/1.8/net/smtp.rb:680:in `check_response'
c:/ruby/lib/ruby/1.8/net/smtp.rb:593:in `auth_cram_md5'
c:/ruby/lib/ruby/1.8/net/smtp.rb:686:in `critical'
c:/ruby/lib/ruby/1.8/net/smtp.rb:592:in `auth_cram_md5'
c:/ruby/lib/ruby/1.8/net/smtp.rb:571:in `__send__'
c:/ruby/lib/ruby/1.8/net/smtp.rb:571:in `authenticate'

Shikha Sharma wrote:

What Authentication type should be there for sending an email?

http://www.ietf.org/rfc/rfc2821.txt

- --
Phillip Gawlowski
Twitter: twitter.com/cynicalryan

~ "It's hard to be mad at someone who misses you while you're asleep."
- -Calvin

Shikha Sharma wrote:

What Authentication type should be there for sending an email?

When I changed the type of :authentication in config/environment.rb

file, :plain to :cram_md5 now it showed me this error:

Net::SMTPSyntaxError in MailingController#sendmail

Have you actually tried to RTFM of your mail server, and know how it is
configured?

- --
Phillip Gawlowski
Twitter: twitter.com/cynicalryan

YUMMIE--Young Upwardly Mobile Mutant

Usually none.

Most SMTP servers don't authenticate beyond sender domain, source
address and recipient domain.

So try none and see how you go.

Mikel
http://lindsaar.net/

config.action_mailer.smtp_settings = {
    :address => 'smtp.gmail.com',
    :port => 587,
    :domain => 'gmail.com',
    :user_name => 'my_nick@gmail.com',
    :password => 'secret_password',
    :authentication => 'login',
    :enable_starttls_auto => true
  }