summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xLib/smtplib.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 8cca590..6a3de7f 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -290,7 +290,11 @@ class SMTP:
"""
name=string.strip(name)
if len(name)==0:
- name=socket.gethostbyaddr(socket.gethostname())[0]
+ name = socket.gethostname()
+ try:
+ name = socket.gethostbyaddr(name)[0]
+ except socket.error:
+ pass
self.putcmd("helo",name)
(code,msg)=self.getreply()
self.helo_resp=msg
@@ -303,7 +307,11 @@ class SMTP:
"""
name=string.strip(name)
if len(name)==0:
- name=socket.gethostbyaddr(socket.gethostname())[0]
+ name = socket.gethostname()
+ try:
+ name = socket.gethostbyaddr(name)[0]
+ except socket.error:
+ pass
self.putcmd("ehlo",name)
(code,msg)=self.getreply()
# According to RFC1869 some (badly written)