I am getting a Net::SMTPAuthenticationError
both on my development (local) env as well as when I host on Heroku, when I try to send mails from my rails application.
This started after sending the first couple of email (2 mails to be specific).
All research so far made me think that this should could be due to having a 2-factor auth
enabled on the gmail account, but when I checked the account, 2-factor autt
was not enabled.
below is my smtp setting both in config/development.rb
and config/production.rb
:
config.action_mailer.delivery_method = :smtp
# SMTP settings for gmail
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => Rails.configuration.gmail_address,
:password => Rails.configuration.gmail_password,
:authentication => "plain",
:enable_starttls_auto => true
}
My mailer is set up as follow:
class StackoMailer < ActionMailer::Base
def success_mail
@my_email = Rails.configuration.gmail_address
mail(
from: 'notifications@StackoProbe.com',
to: @my_email,
subject: 'Fuck Yeah! Visited successfully...'
)
end
end
On calling PushWatir::StackoMailer.success_mail.deliver_now!
, I get the following error:
2.2.1 :001 > PushWatir::StackoMailer.success_mail.deliver_now!
Net::SMTPAuthenticationError: 534-5.7.14 <http://ift.tt/1NOZYnQ
from /Users/andela/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:976:in `check_auth_response'
from /Users/andela/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:740:in `auth_plain'
from /Users/andela/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:732:in `authenticate'
from /Users/andela/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:567:in `do_start'
from /Users/andela/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/net/smtp.rb:520:in `start'
from /Users/andela/.rvm/gems/ruby-2.2.1/gems/mail-2.6.3/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
from /Users/andela/.rvm/gems/ruby-2.2.1/gems/mail-2.6.3/lib/mail/message.rb:252:in `deliver!'
from /Users/andela/.rvm/gems/ruby-2.2.1/gems/actionmailer-4.2.4/lib/action_mailer/message_delivery.rb:77:in `deliver_now!'
from (irb):1
from /Users/andela/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/console.rb:110:in `start'
from /Users/andela/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/console.rb:9:in `start'
from /Users/andela/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:68:in `console'
from /Users/andela/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/andela/.rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:8:in `require'
from bin/rails:8:in `<main>'
2.2.1 :002 >
What could be causing this?
How can I make this work? Big thanks for responses
Aucun commentaire:
Enregistrer un commentaire