mirror of
https://github.com/NaN-tic/trytond-account_dunning_cron.git
synced 2023-12-13 21:00:14 +01:00
Use new sendmail module
This commit is contained in:
parent
abc063bfee
commit
8eb2c5b249
11
dunning.py
11
dunning.py
|
@ -3,7 +3,7 @@
|
||||||
# the full copyright notices and license terms.
|
# the full copyright notices and license terms.
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
from trytond.transaction import Transaction
|
from trytond.transaction import Transaction
|
||||||
from trytond.tools import get_smtp_server
|
from trytond.sendmail import sendmail
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from email.header import Header
|
from email.header import Header
|
||||||
import logging
|
import logging
|
||||||
|
@ -83,11 +83,4 @@ class Dunning:
|
||||||
msg['From'] = from_addr
|
msg['From'] = from_addr
|
||||||
msg['Subject'] = Header(subject, 'utf-8')
|
msg['Subject'] = Header(subject, 'utf-8')
|
||||||
|
|
||||||
try:
|
sendmail(from_addr, to_addr, msg)
|
||||||
server = get_smtp_server()
|
|
||||||
server.sendmail(from_addr, ', '.join(to_addr), msg.as_string())
|
|
||||||
server.quit()
|
|
||||||
except Exception, exception:
|
|
||||||
logger.info(
|
|
||||||
'Unable to deliver email (%s):\n %s'
|
|
||||||
% (exception, msg.as_string()))
|
|
||||||
|
|
Loading…
Reference in a new issue