사용자 도구

사이트 도구


python:smtplib

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

python:smtplib [2012/01/03 20:01]
kwon37xi 새로 만듦
python:smtplib [2012/01/03 20:03] (현재)
kwon37xi
줄 1: 줄 1:
 ====== Python SMTPLib/Email ====== ====== Python SMTPLib/Email ======
-  * [[http://mg.pov.lt/blog/unicode-emails-in-python|Unicode Emails in Python]]+  * [[http://mg.pov.lt/blog/unicode-emails-in-python|Unicode Emails in Python 2.x]]
  
 <code python> <code python>
-    import smtplib +# Python 2.x Unicode Email
-    from email.MIMEText import MIMEText +
-    from email.Header import Header+
  
-    smtp = smtplib.SMTP("smtp.host.com"+import smtplib 
-     +from email.MIMEText import MIMEText 
-    contents = u"Unicode 내용"+from email.Header import Header 
 + 
 +smtp = smtplib.SMTP("smtp.host.com"
 + 
 +contents = u"Unicode 내용"
          
-    msg = MIMEText(contents.encode("utf-8"), "plain", "utf-8"+msg = MIMEText(contents.encode("utf-8"), "plain", "utf-8"
-    msg["From"] = str(Header(u"보내는이이름", "utf-8")) +msg["From"] = str(Header(u"보내는이이름", "utf-8")) 
-    msg["To"] = str(Header(u"받는이","utf-8")) +msg["To"] = str(Header(u"받는이","utf-8")) 
-    msg["Subject"] = str(Header(u"제목","utf-8"))+msg["Subject"] = str(Header(u"제목","utf-8"))
  
-    smtp.sendmail("보내는이메일주소", "받는이메일주소", msg.as_string())+smtp.sendmail("보내는이메일주소", "받는이메일주소", msg.as_string())
 </code> </code>
python/smtplib.txt · 마지막으로 수정됨: 2012/01/03 20:03 저자 kwon37xi