mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Windows: Fix sending email on computers with non-ascii computer names
This commit is contained in:
parent
1191be9cb0
commit
0d4559f0fe
@ -34,7 +34,13 @@ def safe_localhost():
|
|||||||
# RFC 2821 says we should use the fqdn in the EHLO/HELO verb, and
|
# RFC 2821 says we should use the fqdn in the EHLO/HELO verb, and
|
||||||
# if that can't be calculated, that we should use a domain literal
|
# if that can't be calculated, that we should use a domain literal
|
||||||
# instead (essentially an encoded IP address like [A.B.C.D]).
|
# instead (essentially an encoded IP address like [A.B.C.D]).
|
||||||
fqdn = decode_fqdn(socket.getfqdn())
|
try:
|
||||||
|
fqdn = decode_fqdn(socket.getfqdn())
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
if not iswindows:
|
||||||
|
raise
|
||||||
|
from calibre_extensions.winutil import get_computer_name
|
||||||
|
fqdn = get_computer_name()
|
||||||
if '.' in fqdn and fqdn != '.':
|
if '.' in fqdn and fqdn != '.':
|
||||||
# Some mail servers have problems with non-ascii local hostnames, see
|
# Some mail servers have problems with non-ascii local hostnames, see
|
||||||
# https://bugs.launchpad.net/bugs/1256549
|
# https://bugs.launchpad.net/bugs/1256549
|
||||||
|
Loading…
x
Reference in New Issue
Block a user