Over a million developers have joined DZone.

Send An Email From Python

// description of your code here
Not sure where I got this from, but it does its job. Sends a simple smtp email message in python.

import smtplib
def mail(serverURL=None, sender='', to='', subject='', text=''):
    mail('somemailserver.com', 'me@example.com', 'someone@example.com', 'test', 'This is a test')
    headers = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" % (sender, to, subject)
    message = headers + text
    mailServer = smtplib.SMTP(serverURL)
    mailServer.sendmail(sender, to, message)

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}