IDLE 1.0.2
>>> import smtplib
>>> mailer = smtplib.SMTP('xxx.x.xxx.x')
>>> mailer.set_debuglevel(1)
>>> mailer.login('xxxx', 'xxxxxxx')
send: 'ehlo xxxxxx.xxx.com.cn\r\n'
reply: '250-mail.xxx.com.cn Hello xxxxxx.xxx.com.cn, pleased to meet you\r\n'
reply: '250-ETRN\r\n'
reply: '250-AUTH=LOGIN\r\n'
reply: '250-AUTH LOGIN CRAM-MD5\r\n'
reply: '250-8BITMIME\r\n'
reply: '250 SIZE 0\r\n'
reply: retcode (250); Msg: mail.xxx.com.cn Hello xxxxxx.xxx.com.cn, pleased to meet you
ETRN
AUTH=LOGIN
AUTH LOGIN CRAM-MD5
8BITMIME
SIZE 0
send: 'AUTH CRAM-MD5\r\n'
reply: '334 xxx\r\n'
reply: retcode (334); Msg: xxx
send: 'xxx\r\n'
reply: '235 Authentication successful\r\n'
reply: retcode (235); Msg: Authentication successful
(235, 'Authentication successful')
>>> mailer.sendmail('xxxx@mail.xxx.com.cn', 'xxxx@mail.xxx.com.cn', 'Foo')
send: 'mail FROM:<xxxx@mail.xxx.com.cn> size=3\r\n'
reply: '250 <xxxx@mail.xxx.com.cn>, Sender ok\r\n'
reply: retcode (250); Msg: <xxxx@mail.xxx.com.cn>, Sender ok
send: 'rcpt TO:<xxxx@mail.xxx.com.cn>\r\n'
reply: '250 <xxxx@mail.xxx.com.cn>, Recipient ok\r\n'
reply: retcode (250); Msg: <xxxx@mail.xxx.com.cn>, Recipient ok
send: 'data\r\n'
reply: '354 Please start mail input.\r\n'
reply: retcode (354); Msg: Please start mail input.
data: (354, 'Please start mail input.')
send: 'Foo\r\n.\r\n'
reply: '250 Mail queued for delivery.\r\n'
reply: retcode (250); Msg: Mail queued for delivery.
data: (250, 'Mail queued for delivery.')
{}
>>> mailer.quit()
send: 'quit\r\n'
reply: '221 Closing connection. Good bye.\r\n'
reply: retcode (221); Msg: Closing connection. Good bye.
注1:我把所有涉及到主机名、用户名、密码、域名、转换后的BASE64串都用x代替了。
注2:quit的时候,邮件才发送出去,因为我看到Norton的邮件扫描了,为什么呢?