Commit 6791cb1d authored by scmalte's avatar scmalte

mails.py: continued experimenting

parent 74c50a72
...@@ -12,14 +12,15 @@ def main( ...@@ -12,14 +12,15 @@ def main(
students_receive_mails_as_header=DEFAULT_STUDENTS_RECEIVE_MAILS_AS_HEADER): students_receive_mails_as_header=DEFAULT_STUDENTS_RECEIVE_MAILS_AS_HEADER):
logutils.configure_level_and_format() logutils.configure_level_and_format()
# draft_mbox = "D:\\Program_Data\\Thunderbird Portable\\Data\\profile\\ImapMail\\mail.ethz.ch\\Drafts"
unsent_mbox = "D:\\Program_Data\\Thunderbird Portable\\Data\\profile\\Mail\\Local Folders\\Unsent Messages" unsent_mbox = "D:\\Program_Data\\Thunderbird Portable\\Data\\profile\\Mail\\Local Folders\\Unsent Messages"
# thunderbird_local_folder_dir = "D:\\Program_Data\\Thunderbird Portable\\Data\\profile\\Mail\\Local Folders\\"
mbox_path = pathlib.Path(unsent_mbox) mbox_path = pathlib.Path(unsent_mbox)
mbox_msf_path = pathlib.Path(unsent_mbox + ".msf") mbox_msf_path = pathlib.Path(unsent_mbox + ".msf")
logging.warn("ATTENTION: If you continue, the files\n {}\n {} will be overwritten, if they exist. Make sure that do not have any pending unsent messages!".format(mbox_path, mbox_msf_path)) logging.warn("ATTENTION: If you continue, the files")
logging.warn(" {}")
logging.warn(" {}")
logging.warn("will be overwritten, if they exist. Make sure that do not have any pending unsent messages!".format(mbox_path, mbox_msf_path))
if (input("Do you want to continue (enter 'yes')? ").lower() != "yes"): if (input("Do you want to continue (enter 'yes')? ").lower() != "yes"):
logging.debug("Exiting program because user did not confirm to continue") logging.debug("Exiting program because user did not confirm to continue")
...@@ -36,21 +37,21 @@ def main( ...@@ -36,21 +37,21 @@ def main(
mbox.lock() mbox.lock()
try: try:
msg = mailbox.mboxMessage() msg = mailbox.mboxMessage()
msg.set_unixfrom('author Sat Feb 7 01:05:34 2009') msg.set_unixfrom("author Sat Feb 7 01:05:34 2009")
msg['From'] = "malte@schwerhoff.de" msg["From"] = "malte@schwerhoff.de"
msg['To'] = "scmalte@inf.ethz.ch, malte.schwerhoff@inf.ethz.h" msg["To"] = "scmalte@inf.ethz.ch, malte.schwerhoff@inf.ethz.h"
msg['Subject'] = 'Sample message 1' msg["Subject"] = "Sample message 1"
msg.set_payload('This is the body.\\nFrom (should be escaped).\nThere are 3 lines.\n') msg.set_payload("This is the body.\\nFrom (should be escaped).\nThere are 3 lines.\n")
mbox.add(msg) mbox.add(msg)
mbox.flush() mbox.flush()
msg = mailbox.mboxMessage() msg = mailbox.mboxMessage()
msg.set_unixfrom('author') msg.set_unixfrom("author")
msg['From'] = "malte@schwerhoff.de" msg["From"] = "malte@schwerhoff.de"
msg['To'] = "mun123456789@gmail.com" msg["To"] = "mun123456789@gmail.com"
msg['CC'] = "scmalte@inf.ethz.ch" msg["CC"] = "scmalte@inf.ethz.ch"
msg['BCC'] = " malte.schwerhoff@inf.ethz.h" msg["BCC"] = "malte.schwerhoff@inf.ethz.h"
msg['Subject'] = 'Sample message 2' msg["Subject"] = "Sample message 2"
msg.set_payload(mail_body) msg.set_payload(mail_body)
mbox.add(msg) mbox.add(msg)
mbox.flush() mbox.flush()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment