用telnet测试远程smtp发信
问题:如想简单测试远程smtp账户信息是否正确,能否发信,用telnet可以吗?
尝试:
telnet 148.163.x.x 25
Trying 148.163.x.x...
Connected to 148.163.x.x.
Escape character is '^]'.
220 mail.xxx.com ESMTP Postfix
EHLO mail.xxx.com # 打招呼
250-mail.xxx.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH LOGIN # 请求验证
334 VXNlcm5hbWU6
bGl1b2ZvQHVwdXN0cm333333bQ== # base64加密后的用户名
334 UGFzc3dvcmQ6
MXEydz44444Tg3 # base64加密后的密码
535 5.7.8 Error: authentication failed: UGFzc3dvcmQ6 #验证错误
AUTH LOGIN
334 VXNlcm5hbWU6
bGl3333v
334 UGFzc3dvcmQ6
MXEydz44443
235 2.7.0 Authentication successful #验证成功
MAIL FROM:liuo@xxx.com # 发件人
250 2.1.0 Ok
RCPT TO:liu@anqun.net #收件人
250 2.1.5 Ok
DATA #开始写信
354 End data with <CR><LF>.<CR><LF>
Subject:Sending email using Telnet #标题
This is just a simple test.
. # 写信结束
250 2.0.0 Ok: queued as 4831E40AFD2B
QUIT #退出
221 2.0.0 Bye
Connection closed by foreign host.
如想在Linux的Shell里一句话发信测试,可:echo "Subject: hello" | sendmail liu@anqun.net
参考:https://www.kongtechnology.com/2008/01/27/smtp-authentication-and-send-emails-using-telnet/