From c620b81babce1fab19218cd730b31ad8e7d37a92 Mon Sep 17 00:00:00 2001 From: sidpremkumar Date: Jul 12 2019 22:39:24 +0000 Subject: Mailer gets config values from enviormental variables --- diff --git a/README.rst b/README.rst index 1b81aa4..14eb2dc 100644 --- a/README.rst +++ b/README.rst @@ -46,9 +46,15 @@ Note: Overwrite set to True will ensure that upstream issue fields will clear do issue fields, overwrite set to False will never delete downstream issue fields only append. The optional owner field can be used to specify a username that should be used if -the program cannot find a matching downstream user to assigne an issue too. The owner +the program cannot find a matching downstream user to assignee an issue too. The owner field will also be used to alert users if duplicate downstream issues exist. +To set up the mailer you need to set the following environmental variables: + +1. DEFAULT_FROM - Email address used to send emails + +2. DEFAULT_SERVER - Mail server to be used + Development ----------- diff --git a/sync2jira/mailer.py b/sync2jira/mailer.py index dcc2629..75784b9 100644 --- a/sync2jira/mailer.py +++ b/sync2jira/mailer.py @@ -4,6 +4,7 @@ This script is used to send emails """ import smtplib +import os from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart @@ -12,8 +13,8 @@ class Mailer: """ A mailer component used to send emails """ - DEFAULT_FROM = "" - DEFAULT_SERVER = "" + DEFAULT_FROM = os.environ['DEFAULT_FROM'] + DEFAULT_SERVER = os.environ['DEFAULT_SERVER'] def __init__(self): """Returns mailer object