Skip to content

Instantly share code, notes, and snippets.

@emberian
Forked from anonymous/mail_gen
Created June 18, 2012 17:57
Show Gist options
  • Save emberian/2949714 to your computer and use it in GitHub Desktop.
Save emberian/2949714 to your computer and use it in GitHub Desktop.
import maildb
import email
import time
import datetime
def genarate(STARTDATE, RECIPIENTS, DAYCOUNT, MESSAGE):
last_date = STARTDATE
mail = email.message_from_string(MESSAGE)
msg_lib = []
i = 0
for i in range(0, DAYCOUNT):
recep = 0
while recep < len(RECIPIENTS):
mail['date'] = email.utils.formatdate(time.mktime(last_date.utctimetuple()))
mail['message-id'] = email.utils.make_msgid(domain='lan.lan')
mail['from'] = 'weeall@lol.lol'
mail['to'] = email.utils.formataddr(RECIPIENTS[recep])
msg_lib.append(mail)
recep += 1
last_date = last_date + datetime.timedelta(days=1)
for msg in msg_lib:
print(msg['date'])
print(msg['message-id'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment