Send mail
-
This post is deleted!
-
I have not tested this, but did you try with TLS and 587 port?
server = smtplib.SMTP('smtp.gmail.com', 587) server.starttls() server.login("your.email@gmail.com", "PASSWORD") msg = "YOUR MESSAGE!" server.sendmail("SENDER ADDRESS", "RECIPIENT ADDRESS", msg) server.quit()
-
This post is deleted!
-
This post is deleted!
-
Did you enable the "less secure apps" feature on your account as instructed by @chris-mccaslin?
-
This post is deleted!
-
@Rudy-Trujillo said:
This is what I was trying to avoid.
Can't help thinking if the SSL part of the information passed to the server could be included in the portion it needs which is "secure connection = yes" it would meet the criteria for Googles security. But how to incorporate it in the python script is what I am looking for if it is possible.Just guessing based on what was read in what is needed when attempting to connect to SMTP server.
Gmail SMTP Server: smtp.gmail.com
Gmail SMTP password: Your Gmail password
Gmail SMTP port (TLS): 587
Gmail SMTP port (SSL): 465
Gmail SMTP TLS/SSL required: yes<----how does one incorporate this part into the python script?I am assuming you already have it ( I don't know python the best)
but what I make out of it is your making a socket and setting it to be SMTP_SSL and connect to google on the ssl port,server = smtplib.SMTP_SSL('smtp.gmail.com:465')
Also try this i justt noticed you did not have ttls enabled
import smtplib sender = 'Myemail@gmail.com' toaddrs = 'Myemail@gmail.com' message = """From: Test send from omega To: Recipient < Cold@hotmail.com > Subject: SMTP e-mail test This is a test e-mail message. """ password = 'password' server = smtplib.SMTP_SSL('smtp.gmail.com:587') server.starttls() #required by google server.login(sender,password) server.sendmail(sender, toaddrs, message) server.quit() #if this does not work, then try this
try this non ssl example if above does not work
# Credit to pythonforbegginers.com # http://www.pythonforbeginners.com/google/sending-emails-using-google import smtplib # Specifying the from and to addresses fromaddr = 'fromuser@gmail.com' toaddrs = 'touser@gmail.com' # Writing the message (this message will appear in the email) msg = 'Enter you message here' # Gmail Login username = 'username' password = 'password' # Sending the mail server = smtplib.SMTP('smtp.gmail.com:587') server.starttls() server.login(username,password) server.sendmail(fromaddr, toaddrs, msg) server.quit()
-
@Rudy-Trujillo you must enable the less secure apps feature directly on your Google account, you cannot work around it just with the Python code.
-
This post is deleted!
-
This post is deleted!
-
This post is deleted!