1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-30 03:37:05 +00:00
mailinabox/tests/smtp_submission.py

17 lines
365 B
Python
Raw Normal View History

2013-08-21 13:37:33 +00:00
import smtplib, sys, os
2013-08-21 20:53:22 +00:00
fromaddr = "testuser@" + os.environ.get("DOMAIN", "testdomain.com")
2013-08-21 13:37:33 +00:00
msg = """From: %s
To: %s
This is a test message.""" % (fromaddr, sys.argv[1])
server = smtplib.SMTP(os.environ["INSTANCE_IP"], 587)
server.set_debuglevel(1)
server.starttls()
2013-08-21 20:53:22 +00:00
server.login(fromaddr, "testpw")
2013-08-21 13:37:33 +00:00
server.sendmail(fromaddr, [sys.argv[1]], msg)
server.quit()