我的方法非常简单,基于几个不同的在线资源。我使用这个命令装甲我的用户名和密码:
perl -MMIME::Base64 -e 'print encode_base64("\000user@example.com\000password")'
以下是连接结果的转储:
~$ openssl s_client -connect smtp.koumbit.net:587 -starttls smtp
CONNECTED(00000003)
depth=1 C = US, O = "GeoTrust, Inc.", CN = RapidSSL CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
SNIP Certificate info
---
250 DSN
ehlo riot-nrrd.info
250-bureau.koumbit.net
250-PIPELINING
250-SIZE 20480000
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth plain <paste of base64 encoded output here>
535 5.7.8 Error: authentication failed: authentication failure
quit
221 2.0.0 Bye
closed
我知道我使用的用户名和密码是正确的,因为我的电子邮件客户端正在使用它们。我对smtp或openssl并不十分熟悉。特别是,我不清楚通过EHLO提供的主机名是否具有任何意义......
我(盲目地)尝试的事情:
-crlf
作为参数添加到openssl
答案 0 :(得分:2)
对于调试SMTP
个事务,您可以使用swaks
工具。请在下面找到示例输出。
[clement@myhost ~]$ swaks --from you@gmail.com --to someone@yahoo.com --auth-user you@gmail.com --auth-pass "your_pass" -tls --server smtp.gmail.com --port 587
=== Trying smtp.gmail.com:587...
=== Connected to smtp.gmail.com.
<- 220 mx.google.com ESMTP sy1sm38890738pab.30 - gsmtp
-> EHLO myhost
<- 250-mx.google.com at your service, [223.233.234.250]
<- 250-SIZE 35882577
<- 250-8BITMIME
<- 250-STARTTLS
<- 250-ENHANCEDSTATUSCODES
<- 250 CHUNKING
-> STARTTLS
<- 220 2.0.0 Ready to start TLS
=== TLS started w/ cipher ECDHE-RSA-AES128-GCM-SHA256
=== TLS peer subject DN="/C=US/ST=California/L=Mountain View/O=Google Inc/CN=smtp.gmail.com"
~> EHLO myhost
<~ 250-mx.google.com at your service, [223.233.234.250]
<~ 250-SIZE 35882577
<~ 250-8BITMIME
<~ 250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN
<~ 250-ENHANCEDSTATUSCODES
<~ 250 CHUNKING
~> AUTH LOGIN
<~ 334 VXNlcm5hbWU6
~> <Your_base64_encoded_username>
<~ 334 UGFzc3dvcmQ6
~> <your_base64_encoded_password>
<~ 235 2.7.0 Accepted
~> MAIL FROM:<you@gmail.com>
<~ 250 2.1.0 OK sy1sm38890738pab.30 - gsmtp
~> RCPT TO:<someone@yahoo.com>
<~ 250 2.1.5 OK sy1sm38890738pab.30 - gsmtp
~> DATA
<~ 354 Go ahead sy1sm38890738pab.30 - gsmtp
~> Date: Fri, 11 Apr 2014 23:22:50 +0530
~> To: someone@yahoo.com
~> From: you@gmail.com
~> Subject: test Fri, 11 Apr 2014 23:22:50 +0530
~> X-Mailer: swaks v20120320.0 jetmore.org/john/code/swaks/
~>
~> This is a test mailing
~>
~> .
<~ 250 2.0.0 OK 1397238779 sy1sm38890738pab.30 - gsmtp
~> QUIT
<~ 221 2.0.0 closing connection sy1sm38890738pab.30 - gsmtp
=== Connection closed with remote host.
有关该工具的更多信息here