请问,直接用SMTP协议连接网易,雅虎的邮件服务器为什么不行啊.网易的这项服务好像已经关了,
雅虎的也关了吗?还有其它哪些邮件服务器可以通过SMTP协议连接吗?以下是我的代码:
import java.net.*;
import java.io.*;
class Smtp { public static void main(String[] args)throws Exception
{
//Socket cs=new Socket(InetAddress.getByNam("smtp.mail.yahoo.com.cn"),25);
Socket cs=new Socket(InetAddress.getByNam("smtp.126.com"),25);
BufferedReader bis=new BufferedReader(new InputStreamReader(cs.getInputStream()));
PrintWriter pw=new PrintWriter(cs.getOutputStream());
System.out.println(bis.readLine());
pw.println("HELO smtp.126.com");
System.out.println(bis.readLine());
//pw.println("HELO smtp.mail.yahoo.com.cn");
System.out.println(bis.readLine());
String s1=bis.readLine();
//pw.println("quit");
}
}
雅虎的也关了吗?还有其它哪些邮件服务器可以通过SMTP协议连接吗?以下是我的代码:
import java.net.*;
import java.io.*;
class Smtp { public static void main(String[] args)throws Exception
{
//Socket cs=new Socket(InetAddress.getByNam("smtp.mail.yahoo.com.cn"),25);
Socket cs=new Socket(InetAddress.getByNam("smtp.126.com"),25);
BufferedReader bis=new BufferedReader(new InputStreamReader(cs.getInputStream()));
PrintWriter pw=new PrintWriter(cs.getOutputStream());
System.out.println(bis.readLine());
pw.println("HELO smtp.126.com");
System.out.println(bis.readLine());
//pw.println("HELO smtp.mail.yahoo.com.cn");
System.out.println(bis.readLine());
String s1=bis.readLine();
//pw.println("quit");
}
}
不过就算你连上了又能怎么样呢?后面还有一大堆代码要写。直接使用JavaMail多好。
------ykzhujiang(朱朱):
访问网易时返回的都是:421 closing tramssimition chanael,应该是这项服务关了.
访问Yahoo时返回的是:451 timeout,试了多次,都是这个,不知道这是么原因.
sohu的可以吗?我来试试.
用IIS搭一个SMTP很容易的
很可惜那个时间行,现在已经被屏蔽了
可以把邮箱给我吗,交个朋友?
直接用smtp协议发邮件,但是有些地方还不完全符合smtp标准,有的邮箱可以发,有的不行