Merge pull request #89 from vexxhost/fix-receiver-str
Fix receiver type in email send
diff --git a/staffeln/common/email.py b/staffeln/common/email.py
index b1d3239..6aaaf9b 100644
--- a/staffeln/common/email.py
+++ b/staffeln/common/email.py
@@ -11,9 +11,14 @@
def send(smtp_profile):
"""Email send with SMTP"""
+ dest_header = (
+ smtp_profile["dest_email"]
+ if isinstance(smtp_profile["dest_email"], str)
+ else str(smtp_profile["dest_email"])
+ )
message = MIMEText(smtp_profile["content"], "html", "utf-8")
message["From"] = Header(smtp_profile["src_name"], "utf-8")
- message["To"] = Header(smtp_profile["dest_email"], "utf-8")
+ message["To"] = Header(dest_header, "utf-8")
message["Subject"] = Header(smtp_profile["subject"], "utf-8")
try:
smtp_obj = smtplib.SMTP(
diff --git a/staffeln/conductor/result.py b/staffeln/conductor/result.py
index 88173ca..b107172 100644
--- a/staffeln/conductor/result.py
+++ b/staffeln/conductor/result.py
@@ -32,11 +32,11 @@
subject = "Staffeln Backup result"
if len(CONF.notification.receiver) != 0:
# Found receiver in config, override report receiver.
- receiver = ",".join(CONF.notification.receiver)
+ receiver = CONF.notification.receiver
elif not CONF.notification.project_receiver_domain:
try:
- receiver = ",".join(
- self.backup_mgt.openstacksdk.get_project_member_emails(project_id)
+ receiver = self.backup_mgt.openstacksdk.get_project_member_emails(
+ project_id
)
if not receiver:
LOG.warn(