I'm trying to send an email from python on an AWS Sagemaker jupyter notebook, to let me know when something is done. However, every solution I've found (doing it all from scratch, using Yagmail, whatever) results in this error:
Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 o12sm15924607qtl.48 - gsmtp')
I think this is a security measure, but this is problematic because I don't have a browser to log into.
I have tried
- turning off 2fa
- enabling less secure apps
for reference, this is an example of the code i'm using
#emailing myself
contents = [
'bla bla bla'
]
yagmail.SMTP('*******','********').send('*******', 'Done', contents)
I don't particularly care about compromising my password, nor do I care about security settings, nor do I mind setting up an email through a different service. the account i'm using is exclusively for this task. Does anyone know of a secrete spell, option laid away in Google security, or some other service I can use to make this work?
You could make a SNS Topic and add your E-Mail address you want to send the notification to as a receiver(subscriber). Then you can simply send a Notification/E-Mail using the boto3 SNS Client.
Set up SNS Topic
Send Notification via boto3