ex02.py
ex02.py
—
Python Source,
0Kb
ファイルコンテンツ
#!/usr/bin/env python # ex02.py # compose email message and send # imports for python 2.4 ... see comments for python 2.5 import email.Utils # email.utils import email.MIMEText # email.mime.text import smtplib # subject = 'A computer generated email message' sender = 'YOUR-ID-HERE@is.kochi-u.ac.jp' recipt = sender text = """\ MAKE YOUR OWN MESSAGE HERE. -- YOUR SIGNATURE HERE """ msg = email.MIMEText.MIMEText(text) msg['Subject'] = subject msg['From'] = sender msg['To'] = recipt msg['Date'] = email.Utils.formatdate(localtime=True) s = smtplib.SMTP('mail.is.kochi-u.ac.jp') s.sendmail(sender, [recipt], msg.as_string()) s.close()