|
|
@ -76,8 +76,10 @@ class MailRoom(Bureau):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
self.imapserv.select_folder("INBOX")
|
|
|
|
self.imapserv.select_folder("INBOX")
|
|
|
|
except self.imapserv.abort as err:
|
|
|
|
except self.imapserv.AbortError as err:
|
|
|
|
print("imap connection error: ", err)
|
|
|
|
print("imap connection error: ", err)
|
|
|
|
|
|
|
|
self.imapserv.logout()
|
|
|
|
|
|
|
|
self.imapserv = imapclient.IMAPClient(self.host, use_uid=True, ssl=self.imap_ssl)
|
|
|
|
self.imapserv.login(self.login, self.password)
|
|
|
|
self.imapserv.login(self.login, self.password)
|
|
|
|
self.imapserv.select_folder("INBOX")
|
|
|
|
self.imapserv.select_folder("INBOX")
|
|
|
|
|
|
|
|
|
|
|
@ -228,6 +230,8 @@ class MailRoom(Bureau):
|
|
|
|
msg["From"] = msg_obj["To"]
|
|
|
|
msg["From"] = msg_obj["To"]
|
|
|
|
# TODO: deal with ReplyTo headers properly
|
|
|
|
# TODO: deal with ReplyTo headers properly
|
|
|
|
msg["To"] = msg_obj["From"]
|
|
|
|
msg["To"] = msg_obj["From"]
|
|
|
|
|
|
|
|
msg["Subject"] = "Re: " + msg_obj["Subject"]
|
|
|
|
|
|
|
|
#TODO: add reference headers from msg id for threading
|
|
|
|
msg["Date"] = email.utils.formatdate(localtime=True)
|
|
|
|
msg["Date"] = email.utils.formatdate(localtime=True)
|
|
|
|
msg.attach(email.mime.text.MIMEText(bodytext))
|
|
|
|
msg.attach(email.mime.text.MIMEText(bodytext))
|
|
|
|
|
|
|
|
|
|
|
|