I need to send email using SMTP SSL/Port 465 with my bluehost email.
I can't find working code in google i try more than 5 codes. So, please any have working code for sending email using SMTP SSL/port 465 ?
3 Answers
Jut to clarify the solution from dave here is how i got mine to work with my SSL server (i'm not using gmail but still same). Mine emails if a specific file is not there (for internal purposes, that is a bad thing)
import smtplib import os.path from email.mime.text import MIMEText if (os.path.isfile("filename")): print "file exists, all went well" else: print "file not exists, emailing" msg = MIMEText("WARNING, FILE DOES NOT EXISTS, THAT MEANS UPDATES MAY DID NOT HAVE BEEN RUN") msg['Subject'] = "WARNING WARNING ON FIRE FIRE FIRE!" #put your host and port here s = smtplib.SMTP_SSL('host:port') s.login('email','serverpassword') s.sendmail('from','to', msg.as_string()) s.quit() print "done" Comments
For SSL port 465, you need to use SMTP_SSL, rather than just SMTP.
See here for more info.
Comments
You should never post a question like this. Please let us know what you have done, any tries? Any written code etc.
Anyways I hope this helps
import smtplib fromaddr = '[email protected]' toaddrs = '[email protected]' msg = "I was bored!" # Credentials password = 'password' # The actual mail send server = smtplib.SMTP('smtp.gmail.com:587') server.starttls() server.login(fromaddr,password) server.sendmail(fromaddr, toaddrs, msg) server.quit() print "done" 4 Comments
Beginner
Have you been sending out spam with that server. Only then does that kinda stuff happen. You can easily google for this stuff(D'uh). The best reason why this has happened is because there was a lot of spam sent from your server. Look it up in the google forums
Mahmoud Al Nafei
This code working with gmail account. But i need to send email using my stmp sever not Gmail.
Beginner
@user3658169 it would be nice if you could upvote my answer if it helped you. Thanks