Code:
#! /usr/local/bin/python
import sys
import os
import re
from smtplib import SMTP_SSL as SMTP
from email.mime.text import MIMEText
SMTPserver = 'smtp.att.yahoo.com'
sender = 'me@my_email_domain.net'
destination = ['recipient@her_email_domain.com']
USERNAME = "USER_NAME_FOR_INTERNET_SERVICE_PROVIDER"
PASSWORD = "PASSWORD_INTERNET_SERVICE_PROVIDER"
# plain or html or xml f.e.
text_subtype = 'plain'
content="""\
Test message
"""
subject="Sent from Python"
try:
msg = MIMEText(content, text_subtype)
msg['Subject']= subject
msg['From'] = sender # some SMTP servers will do this automatically, not all
conn = SMTP(SMTPserver)
conn.set_debuglevel(False)
conn.login(USERNAME, PASSWORD)
try:
conn.sendmail(sender, destination, msg.as_string())
finally:
conn.quit()
except Exception, exc:
sys.exit( "mail failed; %s" % str(exc))
Das ganze umbauen dass das in ner Schleife rennt, evtl mit multithreading und mehreren Accounts.
Bussi,
Braz