Exception while sending mail : SMTPSendFailedException: 553 Relaying disallowed as atri.avneesh@crowprojects.in

Exception while sending mail : SMTPSendFailedException: 553 Relaying disallowed as atri.avneesh@crowprojects.in

Hi Zoho Team,
I have just created a domain and configured zoho mail as its mailing server . I am able to send mails from zoho to gmail and from gmail to zoho. But when I am trying to send email via java program I am getting an exception.  Can you please help . Thanks a lot.


com.sun.mail.smtp.SMTPSendFailedException: 553 Relaying disallowed as  SENDER@crowprojects.in

code:-



    public void sendEmail() {

        final String GMAIL_HOST = "smtp.gmail.com";
        final String ZOHO_HOST = "smtp.zoho.com";
        final String SMTP_PORT = "465" ;
        final String SSL_PORT = "465";

        final String SENDER_EMAIL = " SENDER@crowprojects.in";
        final String SENDER_USERNAME = " RECEIVER@crowprojects.in";
        final String SENDER_PASSWORD = "PASSWORD";

        // protocol properties
        Properties props = System.getProperties();
        props.setProperty("mail.smtp.host", ZOHO_HOST); // 
        props.setProperty("mail.smtp.port", SMTP_PORT);
        props.setProperty("mail.smtp.auth", "true");

        props.setProperty("mail.pop3.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
        props.setProperty("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
        props.setProperty("mail.smtp.socketFactory.fallback","false");
        props.setProperty("mail.smtp.socketFactory.port",SSL_PORT);
        props.put("mail.smtp.startssl.enable", "true");

        Session session = Session.getInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(SENDER_USERNAME, SENDER_PASSWORD);
}
  });

        try {
            // create the message
            final MimeMessage msg = new MimeMessage(session);

            // set recipients and content
            msg.setFrom(new InternetAddress(SENDER_EMAIL));
            msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(" recipient@gmail.com", false));
            msg.setSubject("Demo");
            msg.setText("Message Sent via JavaMail", "utf-8", "html");
            msg.setSentDate(new Date());

            Transport transport = session.getTransport("smtp");

            // send the mail
            transport.connect(ZOHO_HOST,Integer.parseInt(SMTP_PORT), SENDER_USERNAME, SENDER_PASSWORD);
            transport.sendMessage(msg, msg.getAllRecipients());
            transport.close();

        } catch (MessagingException e) {
            logger.log(Level.SEVERE, "Failed to send message", e);

        }
    }