from .app import PpApplication
-__version__ = '0.5.1'
+__version__ = '0.5.2'
LOG = logging.getLogger(__name__)
VALID_MAIL_METHODS = ('smtp', 'sendmail')
if 'mail_recipients' in section:
v = section['mail_recipients'].strip()
self.mail_recipients = []
- tokens = self.whitespace_re.split(v)
- for token in tokens:
- if MailAddress.valid_address(token):
- if token not in self.mail_recipients:
- self.mail_recipients.append(token)
- else:
- msg = "Found invalid recipient mail address {!r} in configuration.".format(
- token)
- LOG.error(msg)
+ if v:
+ tokens = self.whitespace_re.split(v)
+ for token in tokens:
+ if MailAddress.valid_address(token):
+ if token not in self.mail_recipients:
+ self.mail_recipients.append(token)
+ else:
+ msg = (
+ "Found invalid recipient mail address {!r} "
+ "in configuration.").format(
+ token)
+ LOG.error(msg)
if 'mail_cc' in section:
v = section['mail_cc'].strip()
self.mail_cc = []
- tokens = self.whitespace_re.split(v)
- for token in tokens:
- if MailAddress.valid_address(token):
- if token not in self.mail_cc:
- self.mail_cc.append(token)
- else:
- msg = "Found invalid cc mail address {!r} in configuration.".format(
- token)
- LOG.error(msg)
+ if v:
+ tokens = self.whitespace_re.split(v)
+ for token in tokens:
+ if MailAddress.valid_address(token):
+ if token not in self.mail_cc:
+ self.mail_cc.append(token)
+ else:
+ msg = "Found invalid cc mail address {!r} in configuration.".format(
+ token)
+ LOG.error(msg)
if 'reply_to' in section:
v = section['reply_to'].strip()
self.reply_to = None
- tokens = self.whitespace_re.split(v)
- if len(tokens):
- if MailAddress.valid_address(tokens[0]):
- self.reply_to = tokens[0]
- else:
- msg = "Found invalid reply mail address {!r} in configuration.".format(
- tokens[0])
- LOG.error(msg)
+ if v:
+ tokens = self.whitespace_re.split(v)
+ if len(tokens):
+ if MailAddress.valid_address(tokens[0]):
+ self.reply_to = tokens[0]
+ else:
+ msg = "Found invalid reply mail address {!r} in configuration.".format(
+ tokens[0])
+ LOG.error(msg)
if 'mail_server' in section:
v = section['reply_to'].strip()