首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SMTPAddressFailedException: 550-验证失败

SMTPAddressFailedException: 550-验证失败
EN

Stack Overflow用户
提问于 2012-06-26 16:00:23
回答 1查看 9.2K关注 0票数 1

我正在使用下面的代码通过java发送电子邮件

代码语言:javascript
复制
 function send(){
   String host1 = "domainname";
   String to = "test@domain.com";
   String from="dontreply@domain.com";
   String subject = "test mail";
   String messageText = "test content";
   boolean sessionDebug = false;
   Properties props = System.getProperties();
   props.put("mail.host", host1);
   props.put("mail.transport.protocol", "smtp");
   Authenticator authenticator = new Authenticator();
   Session mailSession = Session.getInstance(props, authenticator);



       mailSession.setDebug(sessionDebug);
           Message msg = new MimeMessage(mailSession);
   msg.setFrom(new InternetAddress(from));
   InternetAddress[] address = {new InternetAddress(to)};
   msg.setRecipients(Message.RecipientType.TO, address);
   msg.setSubject(subject);
   //msg.setSentDate(new Date());
   msg.setContent(messageText,"text/html");
   Transport.send(msg);
   }
   private class Authenticator extends javax.mail.Authenticator implements java.io.Serializable {
    private PasswordAuthentication authentication;

    public Authenticator() {
         String username = "support@domain.com";

        String password = "**********";
        authentication = new PasswordAuthentication(username, password);
    }
    protected PasswordAuthentication getPasswordAuthentication() {
        return authentication;
    }
}

现在我需要更改发件人地址"someother@domain.com“,并且我必须使用与以前相同的身份验证详细信息发送邮件。如果我只是使用相同的身份验证更改发件人地址,则会收到以下错误:

代码语言:javascript
复制
exceptionjavax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550-Verification failed for <someother@domain.com>
550-No Such User Here"
550 Sender verify failed

是否可以使用相同的身份验证和不同的地址发送邮件.....

有没有人可以帮我找出这个问题……

EN

回答 1

Stack Overflow用户

发布于 2012-06-26 17:28:05

我怀疑是某些配置或策略阻止了from地址未向其注册的外发邮件。如果您的问题是配置用户可以回复的地址(并且该地址应该与您正在进行身份验证的地址不同),那么您可以设置一个reply-to标头。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11203050

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档