I'm using ruby on rails to send some emails:
I wanted to test ActionMailer with my personal gmail account, from my console. however google is displaying the following errors:
Sign-in attempt was blocked
Someone just used your password to try to sign in to your account from a non-Google app. Google blocked them, but you should check what happened. Review your account activity to make sure no one else has access. Check
I used to be able to just use any of the answers from these questions:
Can't send email using Gmail on Heroku
Can't send mail with gmail stmp server (in discourse)
why is devise not sending email via gmail smtp?
But now I just can't send emails using my google account.
What changed? How do I configure my gmail to be able to do this?
This is the code I run from my console:
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'gmail.com',
authentication: 'plain',
enable_starttls_auto: true,
user_name: 'some@gmail.com',
password: '********'
}
mailer = ActionMailer::Base.new
# send mail:
mailer.mail(from: 'some@gmail.com', to: 'some_other@gmail.com', subject: 'test', body: "Hello, you've got mail!").deliver