전자 메일을 보내는 데 사용하는 다음과 같은 서브 루틴이 있습니다. 사용자 "username1"을 쉼표로 구분 된 전자 메일 ID 인 "to" , 다음에 가입 쉼표로쉼표로 구분 된 전자 메일 ID의 목록에서 변수를 제거합니다.
def email (body,subject,to=None):
msg = MIMEText("%s" % body)
msg["Content-Type"] = "text/html"
msg["From"] = "[email protected]"
if to!=None:
to=to.strip()
to=to.strip('[email protected]')
msg["To"] = to
print to