Python Email Function with Gmail

Publicado em: 30 Outubro 2020
no canal de: I.O. Pierce
115
2

In this video we show how to use a python function to send an email with Gmail using the smtplib. We also show one of the most common problems which is caused by the Less secure app access setting in your google account.

Function Code:

import smtplib
def sendEmail(To, Subject, Message):
gmail_user = 'your.email@gmail.com'
gmail_password = 'yourPassword'
msg = "\r\n".join([
"From: " + gmail_user,
"To: " + To,
"Subject: " + Subject,
"",
Message + " "
])
try:
server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo()
server.starttls()
server.login(gmail_user, gmail_password)
server.sendmail(gmail_user, To, msg)
server.close()
print ('Email sent!')
except:
print ('Something went wrong...')


Nesta página do site você pode assistir ao vídeo on-line Python Email Function with Gmail duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário I.O. Pierce 30 Outubro 2020, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 115 vezes e gostou 2 espectadores. Boa visualização!