Skip to content

Instantly share code, notes, and snippets.

@meeuw
Last active August 29, 2015 14:01
Show Gist options
  • Save meeuw/b133ae216e892ffede16 to your computer and use it in GitHub Desktop.
Save meeuw/b133ae216e892ffede16 to your computer and use it in GitHub Desktop.
script for a direct smtp test
import smtplib
import datetime
msg = {
'from': '[email protected]',
'to': '[email protected]',
'server': '127.0.0.1',
'body': '''Subject: test message
From: %(from)s
To: %(to)s
Date: %(date)s
Hello,
This is a test.
Greetings,
Test
''',
'date': datetime.datetime.now().strftime( "%d/%m/%Y %H:%M" )
}
s = smtplib.SMTP(msg['server'])
s.set_debuglevel(1)
s.sendmail(msg['from'], msg['to'], msg['body'] % msg)
s.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment