add support for configuring smtpport in callback_mail
This commit is contained in:
parent
7c998027c0
commit
1f30ecef02
1 changed files with 10 additions and 1 deletions
|
@ -25,6 +25,13 @@ options:
|
||||||
key: smtphost
|
key: smtphost
|
||||||
version_added: '2.5'
|
version_added: '2.5'
|
||||||
default: localhost
|
default: localhost
|
||||||
|
mtaport:
|
||||||
|
description: Mail Transfer Agent Port, port at which server SMTP
|
||||||
|
ini:
|
||||||
|
- section: callback_mail
|
||||||
|
key: smtpport
|
||||||
|
version_added: '2.5'
|
||||||
|
default: 25
|
||||||
to:
|
to:
|
||||||
description: Mail recipient
|
description: Mail recipient
|
||||||
ini:
|
ini:
|
||||||
|
@ -76,6 +83,7 @@ class CallbackModule(CallbackBase):
|
||||||
self.sender = None
|
self.sender = None
|
||||||
self.to = 'root'
|
self.to = 'root'
|
||||||
self.smtphost = os.getenv('SMTPHOST', 'localhost')
|
self.smtphost = os.getenv('SMTPHOST', 'localhost')
|
||||||
|
self.smtpport = 25
|
||||||
self.cc = None
|
self.cc = None
|
||||||
self.bcc = None
|
self.bcc = None
|
||||||
|
|
||||||
|
@ -86,6 +94,7 @@ class CallbackModule(CallbackBase):
|
||||||
self.sender = self.get_option('sender')
|
self.sender = self.get_option('sender')
|
||||||
self.to = self.get_option('to')
|
self.to = self.get_option('to')
|
||||||
self.smtphost = self.get_option('mta')
|
self.smtphost = self.get_option('mta')
|
||||||
|
self.smtpport = int(self.get_option('mtaport'))
|
||||||
self.cc = self.get_option('cc')
|
self.cc = self.get_option('cc')
|
||||||
self.bcc = self.get_option('bcc')
|
self.bcc = self.get_option('bcc')
|
||||||
|
|
||||||
|
@ -93,7 +102,7 @@ class CallbackModule(CallbackBase):
|
||||||
if body is None:
|
if body is None:
|
||||||
body = subject
|
body = subject
|
||||||
|
|
||||||
smtp = smtplib.SMTP(self.smtphost)
|
smtp = smtplib.SMTP(self.smtphost, port=self.smtpport)
|
||||||
|
|
||||||
b_sender = to_bytes(self.sender)
|
b_sender = to_bytes(self.sender)
|
||||||
b_to = to_bytes(self.to)
|
b_to = to_bytes(self.to)
|
||||||
|
|
Loading…
Add table
Reference in a new issue