Small changes for Postfix
diff --git a/staffeln/conductor/notify.py b/staffeln/conductor/notify.py
index 2f77aa9..d0cb852 100644
--- a/staffeln/conductor/notify.py
+++ b/staffeln/conductor/notify.py
@@ -12,19 +12,28 @@
 LOG = log.getLogger(__name__)

 

 

-def _sendEmail(src_email, src_pwd, dest_email, subject, content, smtp_server_domain, smtp_server_port):

+def _sendEmail(

+    src_email,

+    src_pwd,

+    dest_email,

+    subject,

+    content,

+    smtp_server_domain,

+    smtp_server_port,

+):

     message = MIMEMultipart("alternative")

     message["Subject"] = subject

-    message["From"] = src_email

-    message["To"] = dest_email

+    # This part is commented as it won't be able to parce the items in list.

+    # message["From"] = src_email

+    # message["To"] = dest_email

     part = MIMEText(content, "html")

     message.attach(part)

 

     s = smtplib.SMTP(host=smtp_server_domain, port=smtp_server_port)

-    s.ehlo()

-    s.starttls()

+    # s.ehlo()

+    # s.starttls()

     # we can comment this auth func when use the trusted ip without authentication against the smtp server

-    s.login(src_email, src_pwd)

+    # s.login(src_email, src_pwd)

     s.sendmail(src_email, dest_email, message.as_string())

     s.close()

 

@@ -32,25 +41,29 @@
 def SendBackupResultEmail(success_backup_list, failed_backup_list):

     subject = "Backup result"

 

-    html = "<h3>${TIME}</h3>" \

-           "<h3>Success List</h3>" \

-           "<h4>${SUCCESS_VOLUME_LIST}</h4>" \

-           "<h3>Failed List</h3>" \

-           "<h4>${FAILED_VOLUME_LIST}</h4>"

+    html = (

+        "<h3>${TIME}</h3>"

+        "<h3>Success List</h3>"

+        "<h4>${SUCCESS_VOLUME_LIST}</h4>"

+        "<h3>Failed List</h3>"

+        "<h4>${FAILED_VOLUME_LIST}</h4>"

+    )

 

-    success_volumes = '<br>'.join([str(elem) for elem in success_backup_list])

-    failed_volumes = '<br>'.join([str(elem) for elem in failed_backup_list])

+    success_volumes = "<br>".join([str(elem) for elem in success_backup_list])

+    failed_volumes = "<br>".join([str(elem) for elem in failed_backup_list])

     html = html.replace("${TIME}", xtime.get_current_strtime())

     html = html.replace("${SUCCESS_VOLUME_LIST}", success_volumes)

     html = html.replace("${FAILED_VOLUME_LIST}", failed_volumes)

     try:

-        _sendEmail(src_email=CONF.notification.sender_email,

-                   src_pwd=CONF.notification.sender_pwd,

-                   dest_email=CONF.notification.receiver,

-                   subject=subject,

-                   content=html,

-                   smtp_server_domain=CONF.notification.smtp_server_domain,

-                   smtp_server_port=CONF.notification.smtp_server_port)

+        _sendEmail(

+            src_email=CONF.notification.sender_email,

+            src_pwd=CONF.notification.sender_pwd,

+            dest_email=CONF.notification.receiver,

+            subject=subject,

+            content=html,

+            smtp_server_domain=CONF.notification.smtp_server_domain,

+            smtp_server_port=CONF.notification.smtp_server_port,

+        )

         LOG.info(_("Backup result email sent"))

     except Exception as e:

         LOG.error(_("Backup result email send failed. Please check email configuration. %s" % (str(e))))

diff --git a/staffeln/conf/notify.py b/staffeln/conf/notify.py
index c292e51..13375f1 100644
--- a/staffeln/conf/notify.py
+++ b/staffeln/conf/notify.py
@@ -12,30 +12,35 @@
     cfg.ListOpt(
         "receiver",
         default=[],
-        help=_("The receivers of the bakcup result by email."
-               "A list of addresses to receive backup result emails to.  A bare"
-               " string will be treated as a list with 1 address."),
+        help=_(
+            "The receivers of the bakcup result by email."
+            "A list of addresses to receive backup result emails to.  A bare"
+            " string will be treated as a list with 1 address."
+        ),
     ),
     cfg.StrOpt(
         "sender_email",
-        help=_("Log in on an SMTP server that requires authentication."
-               "The user name to authenticate with."
-               ),
+        help=_(
+            "Log in on an SMTP server that requires authentication."
+            "The user name to authenticate with."
+        ),
     ),
+    # We can remove the sender password as we are using postfix to send mail and we won't be authenticating.
     cfg.StrOpt(
         "sender_pwd",
-        help=_("Log in on an SMTP server that requires authentication."
-               "The password for the authentication."
-               ),
+        help=_(
+            "Log in on an SMTP server that requires authentication."
+            "The password for the authentication."
+        ),
     ),
     cfg.StrOpt(
         "smtp_server_domain",
-        default="smtp.gmail.com",
+        default="localhost",
         help=_("the name of the remote host to which to connect"),
     ),
     cfg.StrOpt(
         "smtp_server_port",
-        default="587",
+        default="25",
         help=_("the port to which to connect"),
     ),
 ]