Answer the question
In order to leave comments, you need to log in
How to restrict sending emails via smtp in Python?
def send_email(from_addr, to_addr, body_text):
msg_body = ""
parts = ["From: %s" % from_addr,
"To: %s" % to_addr,
"MIME-Version: 1.0",
"Content-type: text/html",
"Subject: %s" % subject,
"",
body_text
, "\r\n"]
msg_body = "\r\n".join(parts)
server = SMTP(host, 465)
# server.set_debuglevel(1)
server.ehlo()
server.login(usrnme,pswd)
server.sendmail(from_addr, to_addr, msg_body)
server.quit()
send_email("@gmail.com", "@gmail.com", " %s" %(data))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question