mailinabox/tests/test_smtp_server.py

20 lines
415 B
Python
Raw Normal View History

#!/usr/bin/env python3
import smtplib
import sys
2013-09-01 14:39:48 +00:00
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()