2013년 12월 17일 화요일

[Python] 이미지파일 첨부 MIME Mail전송 라이브러리

import MimeWriter, base64

#
# Writes a multipart mail message: text plus associated graphic
#

mfile = "multimsg.eml"
f = open(mfile, "w")

# Create a MimeWriter
mail = MimeWriter.MimeWriter(f)
mail.addheader("From", "Myeong-hun <mhbaek@kernel.tv")
mail.addheader("To", """My friend1 <linux@kernel.tv>,
     My friend2 <mhbaek@korea.com>""")
mail.addheader("Subject", "The Python You Wanted")
mail.addheader("Received", """from thinker [64.134.121.94] by
mail.holdenweb.com
    (SMTPD32-6.04) id A244C78500BA; Fri, 09 Mar 2001 07:33:38 -0500""")

# Mail will be multi-part: First part explains format
part1 = mail.startmultipartbody ("mixed")
part1.write("This is a MIME-encoded message, with attachments. "
"If you are seeing this message your mail program probably cannot "
"show you the attachments. Please try another program, or read 'Web "
"Programming in Python' to see the attached picture."
"""
안녕하세요.
이미지 파일 첨부 메일입니다.
""")

# Second part is intended to be read
part2 = mail.nextpart()
f = part2.startbody("text/plain")
f.write("Here we have a multipart message. This "
"means that the message body must be processed "
"as MIME-encoded content where possible [which "
"it clearly is in Outlook Express]."
"""

regards
Your Humble Author
""")

# Third part is a graphic, which we encode in base64
part3 = mail.nextpart()
part3.addheader("Content-Transfer-Encoding", "base64")
f = part3.startbody("image/gif", [["Name", "python.gif"]])
b64 = base64.encodestring(open("pythonwin.gif", "rb").read())
f.write(b64)

# Never forget to call lastpart!
mail.lastpart()

홈페이지 jQuery 라이브러리에서 CVE-2019-11358 취약점 패치 여부 확인 방법

현재 홈페이지에서 사용 중인 jQuery 라이브러리가 CVE-2019-11358 취약점 패치를 적용했는지 확인하는 방법은 다음과 같습니다. 1. jQuery 버전 확인 홈페이지 소스 코드를 확인하여 jQuery 라이브러리 버전을 직접 확인합니다. 웹 ...