SMTPSendFailedException: 530, Address requires authentication

  • Share
  • Share

Applies to:
NA

Description:
Occurs when trying to send a message

Cause:
You have tried to send a message.

JAVA-Mail , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

  1. admin
    March 20th, 2009 at 10:28 | #1

    You need to authenticate to your SMTP server. The package javadocs for the com.sun.mail.smtp package describe several methods to do this. The easiest is often to replace the call Transport.send(msg); with

    String protocol = “smtp”;
    props.put(“mail.” + protocol + “.auth”, “true”);

    Transport t = session.getTransport(protocol);
    try {
    t.connect(username, password);
    t.sendMessage(msg, msg.getAllRecipients());
    } finally {
    t.close();
    }

    You’ll have to supply the appropriate username and password needed by your mail server. Note that you can change the protocol to “smtps” to make a secure connection over SSL.

  1. No trackbacks yet.