Ruby 1.9, gmail and NET::SMTP

Posted by anshul on Stack Overflow See other posts from Stack Overflow or by anshul
Published on 2010-06-03T13:09:51Z Indexed on 2010/06/03 13:14 UTC
Read the original article Hit count: 510

Filed under:
|
|
|

I am running ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux].

require 'mail'
options = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => 'REMOVED',
  :user_name            => 'REMOVED',
  :password             => 'REMOVED',
  :authentication       => 'plain',
  :enable_starttls_auto => true  }

Mail.defaults do
  delivery_method :smtp, options
end

Mail.deliver do
  to 'REMOVED'
  from 'REMOVED'
  subject 'Testing'
  body 'Test body'
end

results in the error

Net::SMTPAuthenticationError: 530 5.7.0 Must issue a STARTTLS command first. x.REMOVED!

What am I doing wrong and how do I fix it?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about smtp