mirror of https://github.com/CIRCL/AIL-framework
Merge pull request #463 from petmi627/master
Added support for username as notification credentialspull/486/head
commit
c7979d81e3
|
@ -26,6 +26,7 @@ publisher.channel = "Script"
|
|||
def sendEmailNotification(recipient, alert_name, content):
|
||||
|
||||
sender = config_loader.get_config_str("Notifications", "sender")
|
||||
sender_user = config_loader.get_config_str("Notifications", "sender_user")
|
||||
sender_host = config_loader.get_config_str("Notifications", "sender_host")
|
||||
sender_port = config_loader.get_config_int("Notifications", "sender_port")
|
||||
sender_pw = config_loader.get_config_str("Notifications", "sender_pw")
|
||||
|
@ -49,6 +50,9 @@ def sendEmailNotification(recipient, alert_name, content):
|
|||
smtp_server = smtplib.SMTP_SSL(sender_host, sender_port)
|
||||
|
||||
smtp_server.ehlo()
|
||||
if sender_user is not None:
|
||||
smtp_server.login(sender_user, sender_pw)
|
||||
else:
|
||||
smtp_server.login(sender, sender_pw)
|
||||
else:
|
||||
smtp_server = smtplib.SMTP(sender_host, sender_port)
|
||||
|
|
|
@ -28,6 +28,9 @@ sender = sender@example.com
|
|||
sender_host = smtp.example.com
|
||||
sender_port = 1337
|
||||
sender_pw = None
|
||||
# Only needed when the credentials for email server needs a username instead of an email address
|
||||
#sender_user = sender
|
||||
sender_user =
|
||||
|
||||
# optional for using with authenticated SMTP over SSL
|
||||
# sender_pw = securepassword
|
||||
|
|
Loading…
Reference in New Issue