mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix sending email failing of the computer's FQDN is set to a single period. Fixes #1730166 [Failing to send book by email](https://bugs.launchpad.net/calibre/+bug/1730166)
This commit is contained in:
parent
ddcbe31727
commit
9daf8f7f7e
@ -18,7 +18,7 @@ def safe_localhost():
|
|||||||
# 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 = socket.getfqdn()
|
fqdn = socket.getfqdn()
|
||||||
if '.' in 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
|
||||||
try:
|
try:
|
||||||
|
@ -279,7 +279,7 @@ class SMTP:
|
|||||||
# 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 = socket.getfqdn()
|
fqdn = socket.getfqdn()
|
||||||
if '.' in fqdn:
|
if '.' in fqdn and fqdn != '.':
|
||||||
self.local_hostname = fqdn
|
self.local_hostname = fqdn
|
||||||
else:
|
else:
|
||||||
# We can't find an fqdn hostname, so use a domain literal
|
# We can't find an fqdn hostname, so use a domain literal
|
||||||
@ -800,6 +800,7 @@ class SMTP:
|
|||||||
self.close()
|
self.close()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
if _have_ssl:
|
if _have_ssl:
|
||||||
|
|
||||||
class SMTP_SSL(SMTP):
|
class SMTP_SSL(SMTP):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user