Python Email Function with Gmail

Publicado el: 30 octubre 2020
en el 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...')


En esta página del sitio puede ver el video en línea Python Email Function with Gmail de Duración hora minuto segunda en buena calidad , que subió el usuario I.O. Pierce 30 octubre 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 115 veces y le gustó 2 a los espectadores. Disfruta viendo!