现在有很多smtp服务器都采用了身份验证功能,所以你邮件发不出去。关于这方面的知识内容在网上很容易找到相关的资料。

解决方案 »

  1.   

    以前可以发邮件 现在却不行了
    邮件服务器没有问题(在正常使用)
    程序如下:
    //------------------------
    <%@    page import="com.coolservlets.forum.util.*,
                         java.util.*,
                         java.sql.*,                     
                         javax.mail.*,
                         javax.mail.internet.*
                       
                         java.util.Properties.*"
                         
    %>
    <% 
       /////////////////////////////////////       String greent="ddddddddddddddddddddddddddd";
     //  public static void Mail (String inhost, String infrom, String into,String title,String msg) throws Exception {
        String msg="ddddddddddddddddddddddddddd";
        String  title="《绿色》测试";
        String host = "61.166.215.*";
        String from = "[email protected]";
        String to = "[email protected]";
        // Get system properties
        Properties props = System.getProperties();    // Setup mail server
        props.put("mail.smtp.host", host);    // Get session
        Session session0 = Session.getDefaultInstance(props, null);    // Define message
        MimeMessage message = new MimeMessage(session0);    // Set the from address
        message.setFrom(new InternetAddress(from));    // Set the to address
        message.addRecipient(Message.RecipientType.TO, 
          new InternetAddress(to));    // Set the subject
        message.setSubject(title);
    message.setContent(msg, "text/html");
        // Send message
        Transport.send(message);   
       
                   
    %>
      

  2.   

    同意1楼的,很多smtp服务器采用身份验证功能的原因
    比如说163.com、263.net等
    需要另外找不用验证的服务器了!!
      

  3.   

    根据http://www.csdn.net/expert/topic/92/92577.xml?temp=.5709345
    我将用jsp编写的发送邮件程序(采用身份验证功能)通过163.com  km169.net  等的邮件可以发送邮件
    但通过单位内部的邮件系统不能发送邮件(单位的邮件系统使用正常)