1.win7下开启telnet服务,
控制面板---->程序---->打开或者关闭Windows功能---->选中telnet客服端。
2.编写字符转换程序:
import java.io.*;
import sun.misc.BASE64Encoder;
public class BASE64Util {
public static void main(String[] args) throws Exception{
System.out.print("please input your name:");
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String userName = in.readLine();
System.out.print("please input your passWord");
String passWord = in.readLine();
BASE64Encoder encoder = new BASE64Encoder();
System.out.println("encoded useName:" + encoder.encode(userName.getBytes()));
System.out.println("encoded passWord:" + encoder.encode(passWord.getBytes()));
}
}
用于获取登陆的用户名密码;
如:
3.发送流程
在命令行下输入:
telnet smtp.sina.com.cn 25
AUTH LOGIN
//下面拷贝上面的encoded useName:后面的用户名
//拷贝上面的encoded passWord:后面的密码
mail from:<xxxx@sina.cn>
rcpt to:<xxxx@qq.com>
data//发送数据了
from:xxx@sina.cn
to:xxx@qq.com
subject:xx//主题
xxxx//正文
.//要输入.
quit