moth/doc/2013-02-TF5/class-spam.py

19 lines
399 B
Python
Raw Normal View History

2013-01-31 13:54:13 -07:00
#! /usr/bin/python3
import smtplib
import sys
smtpd = smtplib.SMTP("mail.lanl.gov")
template = open("netre-email.txt").read()
assert 'RCPT' in template
assert 'TOKEN' in template
for line in open("netarch-tokens.txt"):
email, token = line.strip().split()
print(email)
msg = template.replace("RCPT", email).replace("TOKEN", token)
smtpd.sendmail("neale@lanl.gov", [email], msg)
#print(msg)