Skip to content

Instantly share code, notes, and snippets.

@lakinwecker
Created March 1, 2019 16:11
Show Gist options
  • Save lakinwecker/2d4fe8419d690c377218e94524e3c0d2 to your computer and use it in GitHub Desktop.
Save lakinwecker/2d4fe8419d690c377218e94524e3c0d2 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import smtplib
sender = 'server@littlecornbb.com'
receivers = ['info@littlecornbb.com']
message = """From: Little Corn Beach & Bungalow <server@littlecornbb.com>
To: Little Corn Beach & Bungalow <info@littlecornbb.com>
Subject: Lakin is testing sending mail x3
This is a test e-mail message, sent from python to ensure that
we can easily send message from the Office 365 server. I am
also testing whether this message ends up in the spam folder or not.
x3
"""
smtp = smtplib.SMTP('smtp.office365.com', port=587)
smtp.set_debuglevel(1)
smtp.ehlo()
if smtp.has_extn('STARTTLS'):
smtp.starttls()
smtp.ehlo()
smtp.login('info@littlecornbb.com', '<redacted>')
smtp.sendmail(sender, receivers, message)
print("Successfully sent email")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment