smtp server test

This commit is contained in:
Joshua Tauberer 2013-09-01 10:39:48 -04:00
parent 7f63c199a6
commit a50f30c411
1 changed files with 19 additions and 0 deletions

19
tests/smtp_server.py Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/python3
import smtplib, sys
if len(sys.argv) < 3:
print("Usage: tests/smtp_server.py host email.to email.from")
sys.exit(1)
host, toaddr, fromaddr = sys.argv[1:4]
msg = """From: %s
To: %s
Subject: SMTP server test
This is a test message.""" % (fromaddr, toaddr)
server = smtplib.SMTP(host, 25)
server.set_debuglevel(1)
server.sendmail(fromaddr, [toaddr], msg)
server.quit()