You can always use twisted which has an smtp library which is used for
concurrency. Not a complete working example but an understanding of
deferreds is required.
Ex:
from twisted.mail import smtp
from twisted.internet import reactor, defer
def sendEmail(to, message, subject="Testing",
_from='(e-mail address removed)'):
"""Used to send emails asyncronously to multiple recipients"""
msg = MIMEText(message)
msg['Subject'] = subject
msg['From'] = _from
msg['To'] = ", ".join(to)
sending = smtp.sendmail('localhost', _from, to, msg)
sending.addCallback(sendComplete, to).addErrback(sendFailed)
def sendFailed(error):
print "Email failed: %r" % (error.getTraceback(),)
def sendComplete(result, recipients):
numDelivered, addrInfo = result
print addrInfo
if (numDelivered != len(recipients)):
log.msg(SmtpError, "Not all recipients received email %r" % addrInfo)
buf = 'TESTING'
sendEmail(to=['(e-mail address removed)'], message=buf)