mirror of
https://github.com/fail2ban/fail2ban.git
synced 2026-03-11 08:55:31 +00:00
Merge pull request #4006 from pzl/smtp-py-wrap
Line-wrap long messages in smtp.py
This commit is contained in:
commit
afe9bc08ec
1 changed files with 4 additions and 2 deletions
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
import socket
|
||||
import smtplib
|
||||
from email.mime.text import MIMEText
|
||||
import email.policy
|
||||
from email.message import EmailMessage
|
||||
from email.utils import formatdate, formataddr
|
||||
|
||||
from fail2ban.server.actions import ActionBase, CallingMap
|
||||
|
|
@ -151,7 +152,8 @@ class SMTPAction(ActionBase):
|
|||
See Python `smtplib` for full list of other possible
|
||||
exceptions.
|
||||
"""
|
||||
msg = MIMEText(text)
|
||||
msg = EmailMessage(policy=email.policy.SMTP)
|
||||
msg.set_content(text)
|
||||
msg['Subject'] = subject
|
||||
msg['From'] = formataddr((self.fromname, self.fromaddr))
|
||||
msg['To'] = self.toaddr
|
||||
|
|
|
|||
Loading…
Reference in a new issue