xrl2012 2014-04-11 03:31
浏览 3964

Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry

package com.gotobus.util.email;
import java.util.Properties;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.SendFailedException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import com.sun.mail.smtp.SMTPAddressFailedException;
public class SendMail {

/**
 * @param args
 */
public static void main(String[] args) {
    String host = "mail.gotobus.com";   //发件人使用发邮件的电子信箱服务器
    String from = "no-reply@gotobus.com";    //发邮件的出发地(发件人的信箱)
    String to = "wushu201404@gmail.com";   //发邮件的目的地(收件人信箱)
 // String to="mark@gotobus.com";

   Properties props = System.getProperties();
   props.put("mail.smtp.host", host);
   props.put("mail.smtp.auth", "false"); //这样才能通过验证
   props.put("mail.transport.protocol", "POP3");
   props.put("mail.smtp.port", "25");   

//   MyAuthenticator myauth = new MyAuthenticator();
   Session session = Session.getDefaultInstance(props, null);

// Session session = Session.getInstance(props);

  MimeMessage message = new MimeMessage(session);

    try {
        message.setFrom(new InternetAddress(from));
        message.addRecipient(Message.RecipientType.TO,
          new InternetAddress(to));
        message.setSubject("测试程序--no-reply--!");
        message.setText("这是用java写的发送电子邮件的测试程序99999wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwa!");
        message.saveChanges();

       try {
           Transport.send(message);
       } catch (SMTPAddressFailedException e) {
           throw new SendFailedException("Unable to send to " + to, e);
          }



        System.out.println("=======success=====");
    } catch (AddressException e) {
        e.printStackTrace();
    } catch (MessagingException e) {
        e.printStackTrace();
    }



}

}
----具体情况描述--------
这个案例是用javamail实现不需要校验身份信息实现邮件发送的功能,目前自己所用的是企业内部邮箱,代码可以实现的是给内部邮箱发件。但换成qq.163.gmail等邮件时,出现了上面的报错。。。。。。但使用perl语言时可以顺利转发,所以,邮箱账户应该不存在问题,求助大神诊断!!!!!!!!!!!!感激不尽!!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 spring后端vue前端
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题