530-5.5. Authentication required - Error

122 views
Skip to first unread message

MadasamyJeyam ,s

unread,
Oct 17, 2013, 8:55:27 AM10/17/13
to mail...@googlegroups.com
Hi
  My environment
           Operationg system: Linux mint
           Ruby                    :2.0.0-p247
           Mail                      :2.5.4

My code is

require 'mail'

Mail.defaults do
  delivery_method :smtp, {
    :address => 'smtp.gmail.com',
    :port => '587',
    :domain => 'smtp.gmail.com',
    :user_name => ENV['user1'],
    :password => ENV['mypassword'],
    :authentication => :plain,
    :enable_starttls_auto => true
  }
end

Mail.deliver do
   from    'us...@gmail.com'
   to      'us...@gmail.com'
   subject 'Here is my first test mail'
 
end
When i execute this program I get following exception

/home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:950:in `check_response': 530-5.5.1 Authentication Required. Learn more at (Net::SMTPAuthenticationError)
    from /home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:919:in `getok'
    from /home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:834:in `mailfrom'
    from /home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:661:in `send_message'
    from /home/.rvm/gems/ruby-2.0.0-p247/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:113:in `block in deliver!'
    from /home/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/smtp.rb:520:in `start'
    from /home/.rvm/gems/ruby-2.0.0-p247/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
    from /home/.rvm/gems/ruby-2.0.0-p247/gems/mail-2.5.4/lib/mail/message.rb:2129:in `do_delivery'
    from /home/.rvm/gems/ruby-2.0.0-p247/gems/mail-2.5.4/lib/mail/message.rb:234:in `deliver'
    from /home/.rvm/gems/ruby-2.0.0-p247/gems/mail-2.5.4/lib/mail/mail.rb:140:in `deliver'
    from ./emailsample.rb:15:in `<main>'
Reply all
Reply to author
Forward
0 new messages