'SMTPAddressFailedException: 550-Verification failed

i am using following code for sending emails using java

 function send(){
   String host1 = "domainname";
   String to = "[email protected]";
   String from="[email protected]";
   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 = "[email protected]";

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

which works fine .But now i need to change the from address "[email protected]" and i have to send mails using the same authentication details as before. if i just change my from address with the same authentication am getting the following error:

exceptionjavax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 550-Verification failed for <[email protected]>
550-No Such User Here"
550 Sender verify failed

is this possible to send mails with same authentication and different from address.....

Can any one help me in finding the issue .....



Solution 1:[1]

What I suspect is that there is some configuration or policy which prevents the outgoing mails where the from address is not registered with it. If you problem is to configure an address where the users can reply to (and which should be different from the one you are authenticating), then there is a reply-to header which you can set.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Santosh