do not limit From: field to email address-only, closes #87
You may now set a full From header, e.g.: [smtp] from = Foo Bar <spam@local> If not, the old name "Ich schrei sonst!" is used.
This commit is contained in:
parent
5c91a84951
commit
e6fdfb03eb
@ -184,7 +184,7 @@ to
|
||||
recipient address, e.g. your email address
|
||||
|
||||
from
|
||||
sender address, e.g. isso@example.tld
|
||||
sender address, e.g. `"Foo Bar" <isso@example.tld>`
|
||||
|
||||
timeout
|
||||
specify a timeout in seconds for blocking operations like the
|
||||
|
@ -8,6 +8,7 @@ import logging
|
||||
import threading
|
||||
import multiprocessing
|
||||
|
||||
from email.utils import parseaddr, formataddr
|
||||
from configparser import ConfigParser
|
||||
|
||||
try:
|
||||
@ -145,6 +146,9 @@ class Config:
|
||||
logger.info("Your `session-key` has been stored in the "
|
||||
"database itself, this option is now unused")
|
||||
|
||||
if not parseaddr(rv.get("smtp", "from"))[0]:
|
||||
rv.set("smtp", "from", formataddr((u"Ich schrei sonst!", rv.get("smtp", "from"))))
|
||||
|
||||
return rv
|
||||
|
||||
|
||||
|
@ -125,7 +125,7 @@ class SMTP(object):
|
||||
to_addr = self.conf.get("to")
|
||||
|
||||
msg = MIMEText(body, 'plain', 'utf-8')
|
||||
msg['From'] = "Ich schrei sonst! <%s>" % from_addr
|
||||
msg['From'] = from_addr
|
||||
msg['To'] = to_addr
|
||||
msg['Date'] = formatdate(localtime=True)
|
||||
msg['Subject'] = Header(subject, 'utf-8')
|
||||
|
Loading…
Reference in New Issue
Block a user