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...')
In questa pagina del sito puoi guardare il video online Python Email Function with Gmail della durata di ore minuti seconda in buona qualità , che l'utente ha caricato I.O. Pierce 30 ottobre 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 115 volte e gli è piaciuto 2 spettatori. Buona visione!