Last active
September 9, 2015 01:21
-
-
Save trejo08/764ccc93711ebd454927 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Script to send emails through Python to remote email | |
import os | |
import smtplib | |
from email.mime.text import MIMEText | |
from email.mime.imagen import MIMEImage | |
from email.mime.multipart import MIMEMultipart | |
#def SendMail(ImageFileName): | |
def SendMail(): | |
to = "email address" | |
email_from = "email sender" | |
# img_data = open(ImageFileName, 'rb').read() | |
msg = MIMEMultipart() | |
msg['Subject'] = 'test send image' | |
msg['From'] = email_from | |
msg['To'] = to | |
text = MIMEText("email test form images") | |
msg.attach(text) | |
# image = MIMEImage(img_data, name=os.path.basename(ImgFileName)) | |
# msg.attach(image) | |
s = smtplib.SMTP(server, por) | |
# s.ehlo() | |
s.starttls() | |
# s.ehlo() | |
s.login(email_from, "password") | |
s.sendmail(email_from, to, msg.as_string()) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment