Smtp Sending E-mail Issue With Gmail
I have a script that sends a .png file with SMTP. When I use a hotmail account; smtplib.SMTP('smtp.live.com', 587) It works without any problem. But when I use a gmail account; sm
Solution 1:
you can user smtplib and email for sending emails, this code working for me after i follow this steps.
steps are
- Sign in to Gmail.
- Click the gear in the top right .
- Select Settings.
- Click Forwarding and POP/IMAP.
- Select Enable IMAP. 6.Click Save Changes
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
me = "your email"
my_password = r"your password"
you = "to email id"
msg = MIMEMultipart('alternative')
msg['Subject'] = "Alert"
msg['From'] = me
msg['To'] = you
html = '<html><body><p>Hi, I have the following alerts for you!</p></body></html>'
part2 = MIMEText(html, 'html')
msg.attach(part2)
s = smtplib.SMTP_SSL('smtp.gmail.com')
s.login(me, my_password)
s.sendmail(me, you, msg.as_string())
print s
s.quit()
Post a Comment for "Smtp Sending E-mail Issue With Gmail"