-
-
Save emberian/2949714 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'] = '[email protected]' | |
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