Cyril Jaquier 2005-09-12 14:42:08 +00:00
parent 11d887c603
commit 0d4302c912
1 changed files with 5 additions and 2 deletions

View File

@ -27,6 +27,7 @@ __license__ = "GPL"
import logging, smtplib
from utils.strings import replaceTag
from time import strftime, gmtime
# Gets the instance of the logger.
logSys = logging.getLogger("fail2ban")
@ -55,8 +56,10 @@ class Mail:
subj = replaceTag(subject, aInfo)
msg = replaceTag(message, aInfo)
mail = ("From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n" %
(self.fromAddr, ", ".join(self.toAddr), subj)) + msg
mail = ("From: %s\r\nTo: %s\r\nDate: %s\r\nSubject: %s\r\n\r\n" %
(self.fromAddr, ", ".join(self.toAddr),
strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime()),
subj)) + msg
try:
server = smtplib.SMTP(self.host, self.port)