我正在尝试使用Python的smtplib连接到Dovecot服务器。两者似乎都很有能力,但我必须遗漏一些基本的东西。在任何一个文档中找不到任何内容。
立即拒绝非SSL连接......
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32
>>> import smtplib
>>> x = smtplib.SMTP()
>>> x.set_debuglevel(True)
>>> x.connect('mail.jc-bell.com', 995)
connect: ('mail.jc-bell.com', 995)
connect: (995, 'mail.jc-bell.com')
SSL连接似乎很接近,但Dovecot除了ehlo / helo
之外还需要一些东西>>> import smtplib
>>> x = smtplib.SMTP_SSL()
>>> x.set_debuglevel(True)
>>> x.connect('mail.TheMailServer.com', 995)
connect: ('mail.TheMailServer.com', 995)
connect: ('mail.TheMailServer.com', 995)
reply: '+OK Dovecot ready.\r\n'
reply: retcode (-1); Msg: Dovecot ready.
connect: Dovecot ready.
(-1, 'Dovecot ready.')
>>> x.login('me@TheMailServer.com', '...')
send: 'ehlo my.host\r\n'
reply: '-ERR Unknown command.\r\n'
reply: retcode (-1); Msg: Unknown command.
send: 'helo my.host\r\n'
reply: '-ERR Unknown command.\r\n'
reply: retcode (-1); Msg: Unknown command.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Software\Python27\lib\smtplib.py", line 564, in login
self.ehlo_or_helo_if_needed()
File "C:\Software\Python27\lib\smtplib.py", line 527, in ehlo_or_helo_if_needed
raise SMTPHeloError(code, resp)
smtplib.SMTPHeloError: (-1, 'Unknown command.')
我错过了什么?
服务器的证书是自签名的,但我不认为这是一个CA问题,因为我已经达到'+ OK ...'。