Skip to content

Instantly share code, notes, and snippets.

@jdowner
Created January 23, 2015 16:54
Show Gist options
  • Save jdowner/7dfe2572837dba3e3fac to your computer and use it in GitHub Desktop.
Save jdowner/7dfe2572837dba3e3fac to your computer and use it in GitHub Desktop.

Revisions

  1. jdowner created this gist Jan 23, 2015.
    25 changes: 25 additions & 0 deletions sendmail.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    #!/usr/bin/env python

    import email.mime.text
    import smtplib

    username = '[email protected]'
    password = '****************'
    hostname = 'outlook.office365.com'

    msg = email.mime.text.MIMEText('test')
    msg['Subject'] = 'test'
    msg['From'] = '[email protected]'
    msg['To'] = '[email protected]'

    server = smtplib.SMTP(hostname, 587)
    server.ehlo()
    server.starttls()
    server.ehlo()
    server.login(username, password)
    server.sendmail(
    '[email protected]',
    ['[email protected]'],
    msg.as_string(),
    )
    server.close()