[gsoc-admin] EmailTemplate: Add sender, cc, bcc
- From: Lasse Schuirmann <lschuirma src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gsoc-admin] EmailTemplate: Add sender, cc, bcc
- Date: Wed, 12 Aug 2015 18:21:11 +0000 (UTC)
commit d0abbdd1247638ce025432d108fe75cf00c69ee8
Author: Lasse Schuirmann <lasse schuirmann gmail com>
Date: Wed Aug 12 20:20:48 2015 +0200
EmailTemplate: Add sender, cc, bcc
maillib/config.py | 6 +++++-
maillib/email.py | 13 ++++++++++---
2 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/maillib/config.py b/maillib/config.py
index a3306a7..ccdb4fd 100644
--- a/maillib/config.py
+++ b/maillib/config.py
@@ -78,6 +78,9 @@ class EventConfig:
def append_mail_from_section(self, section):
text = get_main_data_from_section(section)
+ sender = section['sender']
+ cc = section['cc']
+ bcc = section['bcc']
recipients_mail_column = section['recipients_mail_column']
recipients_name_column = section.get('recipients_name_column', None)
recipients = []
@@ -86,7 +89,8 @@ class EventConfig:
name = row.get(recipients_name_column, None)
recipients.append(Contact(mail, name))
- self.mail_templates.append(EmailTemplate(text, recipients))
+ self.mail_templates.append(
+ EmailTemplate(text, sender, recipients, cc, bcc))
def append_ics_from_section(self, section):
ics_data = get_main_data_from_section(section)
diff --git a/maillib/email.py b/maillib/email.py
index 1e477a0..72ec1bb 100755
--- a/maillib/email.py
+++ b/maillib/email.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
-def send_mail(text, recipient):
+def send_mail(text, sender, recipient, cc, bcc):
raise NotImplementedError
@@ -19,9 +19,12 @@ class Contact:
class EmailTemplate:
- def __init__(self, text, recipients):
+ def __init__(self, text, sender, recipients, cc="", bcc=""):
self.text = text
+ self.sender = sender
self.recipients = recipients
+ self.cc = cc
+ self.bcc = bcc
def get_specific(self, data_dict):
return self.text.format(**data_dict)
@@ -30,7 +33,11 @@ class EmailTemplate:
data_dict = data_dict.copy()
for recipient in self.recipients:
data_dict['recipient_name'] = recipient.name
- send_mail(self.get_specific(data_dict), recipient.pretty_email_name())
+ send_mail(self.get_specific(data_dict),
+ self.sender,
+ recipient.pretty_email_name(),
+ self.cc,
+ self.bcc)
if __name__ == '__main__':
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]