Telnet发送邮件
准备环境
测试邮件用户名和密码:
139邮箱:415558259@139.com 密码:415558259
Linux操作系统:
cat /etc/redhat-release
CentOS release 6.5 (Final)
获取邮箱和密码的Base64的值
415558259@139.com的base64值是:NDE1NTU4MjU5QDEzOS5jb20=
415558259的base64值是:NDE1NTU4MjU5
可以使用下面代码获取base64值
package com.hh.socket;
import java.io.IOException;
import sun.misc.BASE64Encoder;
public class Test {
public static void main(String[] args) throws IOException {
String str=new BASE64Encoder().encode("415558259@139.com".getBytes());
System.out.println(str);
str=new BASE64Encoder().encode("415558259".getBytes());
System.out.println(str);
}
}
测试过程
[tony@localhost Desktop]$ telnet smtp.139.com 25
Trying 221.176.9.170...
Connected to smtp.139.com.
Escape character is '^]'.
220 localhost richmail system v10(2ef658d3a57dec2-ce252)
quit
221 localhost richmail system closing transmission channel
Connection closed by foreign host.
[tony@localhost Desktop]$ telnet smtp.139.com 25
Trying 221.176.9.170...
Connected to smtp.139.com.
Escape character is '^]'.
220 localhost richmail system v10(2f0158d3a5c7747-52df5)
EHLO localhost
250-mail
250-STARTTLS
250-PIPELINING
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250 8BITMIME
AUTH LOGIN
334 dXNlcm5hbWU6
aGVuZ2h1aXhpbmRhQDEzOS5jb20=
334 UGFzc3dvcmQ6
aGVuZ2h1aXhpbmRh
235 Authentication successful
MAIL FROM:<415558259@139.com>
250 ok
RCPT TO:<15367811408@139.com>
250 ok
DATA
354 end with .
From: "Bob Example" <415558259@139.com>
To: "Alice Example" <15367811408@139.com>
Subject: Test message
Hello Alice.
This is a test message with 5 header fields and 4 lines in the message body.
Your friend,
Bob
.
250 ok
QUIT