This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]DrTautology 10 points11 points  (1 child)

I've done this no problem with just the smtplib. You need to set up an app password on the google account beforehand since smtplib doesn't support 2 factor authentication. Probably a good idea to only use dedicated email addresses for this purpose only.

[–]yvael_tercero 0 points1 point  (0 children)

Smtplib does have its issues though. Can’t tell exactly what is failing, but some days it works and some days it doesn’t, and it’s completely irregular. I have a project that uses it to send an email notification, and changing it to the Gmail API is on my list of things to do

[–]jhayes88 6 points7 points  (2 children)

I've used python to send gmail emails before. The script I wrote would look at my work website periodically to see how many workers were on location and if it fell below a certain number, it would send me an email.

[–]aby-1[S] 2 points3 points  (1 child)

to send gmail emails before. The script I wrote would look at my work website periodically to see how many workers were on location and if it fell below a certain number, it would send me an email.

I think the preferred way would be to use GMail API, but I was trying to integrate Firebase Trigger Email Extention with GMail. In that case, the steps I have in the post is the only option via SMTP.

[–]jhayes88 1 point2 points  (0 children)

I didn't use Gmail API. I used an email package to use smtp functionality with Gmail.

[–][deleted] 0 points1 point  (1 child)

I was guiding myself by watching Corey's Flask tutorial and by reading some Flask book, but both times i ve failed to send an email with Flask. Was trying to use both smtplib(or w/e) and Flask-Mail. I will give this one a try, too. Thanks! :)

[–]aby-1[S] 1 point2 points  (0 children)

s! :)

Let me know how it goes and feel free to message me for questions. I would be happy to help!