Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mail issue
#1
am new to python , try to program to send a mail , showing error , please help

email = '[email protected]'
password = '********'
send_to_mail = '[email protected]'
message = 'online'
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttLs()
server.login(email, password)
server.sendmail(email, send_to_mail, message)
server.quit()
Reply
#2
Are you going to show the error? Is it a python error or a google error?
Reply
#3
You can use smtplib.SMTP_SSL method.

smtp_host="smtp.gmail.com"
smtp_ssl_port=465

email = '[email protected]'
password = '********'
send_to_mail = '[email protected]'
message = 'online'

server = smtplib.SMTP_SSL(smtp_host, smtp_ssl_port)
server.ehlo()
server.login(email, password)
server.sendmail(email, send_to_mail, msg)
server.close()
reference: Python freezes on smtplib.SMTP(“smtp.gmail.com”, 587)
Reply
#4
(Dec-03-2020, 04:44 AM)Superjoe Wrote: You can use smtplib.SMTP_SSL method。

smtp_host="smtp.gmail.com"
smtp_ssl_port=465

email = '[email protected]'
password = '********'
send_to_mail = '[email protected]'
message = 'online'

server = smtplib.SMTP_SSL(smtp_host, smtp_ssl_port)
server.ehlo()
server.login(email, password)
server.sendmail(email, send_to_mail, msg)
server.close()
reference: Python freezes on smtplib.SMTP(“smtp.gmail.com”, 587)
THANKS BRO
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  o365 special subject mail download issue anna 3 2,899 May-16-2019, 07:16 PM
Last Post: micseydel
  smtplib mail without subject anna 2 2,474 Apr-24-2019, 05:44 AM
Last Post: anna
  Mail Faiyaz 1 26,063 Sep-24-2018, 02:29 PM
Last Post: Larz60+
  Outlook mail watcher g_shanmuga 1 5,060 Mar-26-2018, 04:09 PM
Last Post: nilamo
  Simple e-mail sender, that automatically changes subject for every e-mail joker 2 3,163 Aug-24-2017, 09:45 AM
Last Post: joker
  Mail is not sent to multiple users ur00361883 1 3,198 Apr-25-2017, 07:00 AM
Last Post: ur00361883

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020