summaryrefslogtreecommitdiff
path: root/service/pixelated
diff options
context:
space:
mode:
authorGiovane <giovaneliberato@gmail.com>2015-11-19 16:20:52 -0200
committerGiovane <giovaneliberato@gmail.com>2015-11-19 16:21:08 -0200
commitc21a6ddf277514c62a89cbd9214ec4fc905b4988 (patch)
tree6bfa9cbcb5d2522649d5985bd8d323c9f5491511 /service/pixelated
parent2615c785260ea168f0eb8d9fe2a8a6576a5392dd (diff)
Move 'From' initialization to InputMail factory. w/ @bwagner #531
Diffstat (limited to 'service/pixelated')
-rw-r--r--service/pixelated/adapter/mailstore/leap_mailstore.py1
-rw-r--r--service/pixelated/adapter/model/mail.py4
-rw-r--r--service/pixelated/adapter/services/mail_service.py4
3 files changed, 2 insertions, 7 deletions
diff --git a/service/pixelated/adapter/mailstore/leap_mailstore.py b/service/pixelated/adapter/mailstore/leap_mailstore.py
index 21c85b74..42e065ac 100644
--- a/service/pixelated/adapter/mailstore/leap_mailstore.py
+++ b/service/pixelated/adapter/mailstore/leap_mailstore.py
@@ -337,7 +337,6 @@ class LeapMailStore(MailStore):
# fetch mailbox name by mbox_uuid
mbox_uuid = message.get_wrapper().fdoc.mbox_uuid
mbox_name = yield self._mailbox_name_from_uuid(mbox_uuid)
-
mail = LeapMail(mail_id, mbox_name, message.get_wrapper().hdoc.headers, set(message.get_tags()), set(message.get_flags()), body=body, attachments=self._extract_attachment_info_from(message)) # TODO assert flags are passed on
defer.returnValue(mail)
diff --git a/service/pixelated/adapter/model/mail.py b/service/pixelated/adapter/model/mail.py
index 0daa6296..bb47a434 100644
--- a/service/pixelated/adapter/model/mail.py
+++ b/service/pixelated/adapter/model/mail.py
@@ -160,7 +160,6 @@ class InputMail(Mail):
def to_smtp_format(self):
mime_multipart = self.to_mime_multipart()
- mime_multipart['From'] = InputMail.FROM_EMAIL_ADDRESS
return mime_multipart.as_string()
@staticmethod
@@ -180,11 +179,10 @@ class InputMail(Mail):
input_mail.headers = {key.capitalize(): value for key, value in mail_dict.get('header', {}).items()}
input_mail.headers['Date'] = date.mail_date_now()
+ input_mail.headers['From'] = InputMail.FROM_EMAIL_ADDRESS
input_mail.body = mail_dict.get('body', '')
-
input_mail.tags = set(mail_dict.get('tags', []))
-
input_mail._status = set(mail_dict.get('status', []))
return input_mail
diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py
index 7e6f1c63..6ecf3245 100644
--- a/service/pixelated/adapter/services/mail_service.py
+++ b/service/pixelated/adapter/services/mail_service.py
@@ -88,10 +88,9 @@ class MailService(object):
@defer.inlineCallbacks
def send_mail(self, content_dict):
mail = InputMail.from_dict(content_dict)
- mail.headers['From'] = self.account_email
draft_id = content_dict.get('ident')
-
yield self.mail_sender.sendmail(mail)
+
sent_mail = yield self.move_to_sent(draft_id, mail)
defer.returnValue(sent_mail)
@@ -102,7 +101,6 @@ class MailService(object):
yield self.mail_store.delete_mail(last_draft_ident)
except Exception as error:
pass
-
sent_mail = yield self.mail_store.add_mail('SENT', mail.raw)
sent_mail.flags.add(Status.SEEN)
yield self.mail_store.update_mail(sent_mail)