准备base64 工具。
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
//import sun.misc.BASE61Encoder;
/*
* 用户名 = 你的用户名
* 密码 = 你的密码
telnet smtp.189.cn 25
ehlo tan
auth login
mail from:18952058349@189.cn
rcpt to: 1625188464@qq.com
data
from:1895205839@189.cn
subject:test HiHI
* learning how to send E-mail !
.
quit
*
*/
public class BASE64Util
{
public static void main(String [] args) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.println("转码前:");
System.out.print("用户名 = ");
String userName = in.readLine();
System.out.print("密码 = ");
String pwd = in.readLine();
sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder();
System.out.println("\n转码后:");
System.out.println("用户名 : " + encoder.encode(userName.getBytes()));
System.out.println("密码 : " + encoder.encode(pwd.getBytes()));
}
}
输入备注的命令
telnet smtp.189.cn 25
ehlo tan
auth login
加密后的用户名
加密后的密码
mail from:18952058349@189.cn
rcpt to: 1625188464@qq.com
data
from:1895205839@189.cn
subject:test HiHI
- learning how to send E-mail !
.
quit
备注
myeclipse 出现Acccess restriction错误时:
window-preference>java-compiler-Errors>
Warnings>Deprecated and restricted API-Forbiddenn reference(access rules)的Error改为Warning.