-1

Google blocked sending emails using smtplib method. I had posted this problem and this code yesterday. It turns out that google is turning off less secure apps.

import smtplib
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login('chilwillmike@gmail.com','***********')
server.sendmail('chilwillmike@gmail.com','lambypeter@gmail.com','Hello im your bot')
print('mail sent')

Anyone have another idea to use it ?

Kris
  • 7,882
  • 3
  • 37
  • 64
johnx
  • 41
  • 5
  • You can create app only passwords from the google account and use it. – Kris Jun 01 '22 at 13:52
  • @kris can i use another email platform instead of google or outlook? – johnx Jun 01 '22 at 13:54
  • SMTP is a general protocol that works with any mail exchange server. So technically yes, you can. At the same time, the acceptance of the emails from a different server purely depends on its popularity. For instance some mails could go to spam, if the service is not good. You can use GMail API if you want to work with GMail or use some services like mailgun as well. – Kris Jun 01 '22 at 13:56
  • I use [yagmail](https://pypi.org/project/yagmail/) and it works perfectly – Tomerikoo Jun 01 '22 at 14:05
  • If in the `*****` you put your actual Gmail password then this is why it doesn't work. You need to put an [App Password](https://support.google.com/accounts/answer/185833?hl=en) – Tomerikoo Jun 01 '22 at 14:08

0 Answers0