reply: b'220 126.com Anti-spam GT for Coremail System (126com[20140526])\r\n' reply: retcode (220); Msg: b'126.com Anti-spam GT for Coremail System (126com[20140526])' connect: b'126.com Anti-spam GT for Coremail System (126com[20140526])' send: 'ehlo TOMAS-PC.DHCP HOST\r\n' reply: b'500 Error: bad syntax\r\n' reply: retcode (500); Msg: b'Error: bad syntax' send: 'helo TOMAS-PC.DHCP HOST\r\n' reply: b'500 Error: bad syntax\r\n' reply: retcode (500); Msg: b'Error: bad syntax' (500, b'Error: bad syntax')
fqdn = socket.getfqdn() if '.' in fqdn: self.local_hostname = fqdn else: # We can't find an fqdn hostname, so use a domain literal addr = '127.0.0.1' try: addr = socket.gethostbyname(socket.gethostname()) except socket.gaierror: pass self.local_hostname = '[%s]' % addr
python3.6 smtplib模块中的
fqdn = socket.getfqdn()
返回值是: TOMAS-PC.DHCP HOST
但是126邮件服务器认为"TOMAS-PC.DHCP HOST"不是主机名,也不是域名,
所以出现使用python发邮件时,提示语法错误。
来源:https://www.cnblogs.com/tinyos/p/7374862.html