Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SMTPSendFailedException: 554 Message does not conform to standards

843834Nov 24 2007 — edited Nov 25 2007
Hi everyone!
I have a program that send mail using JavaMail :
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;

public class demo {
   public static void main (String args[]) throws Exception {

    String host = myMailHost;
    String from = mailFrom;
    String to = mailTo;
    String userName = "userName";
    String password = "password";

    Properties props = System.getProperties();

    props.put("mail.smtp.host", host);
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.port", 25);
    props.put("mail.smtp.auth", "true");
	props.put("mail.smtp.starttls.enable","true");
	props.put("mail.smtp.quitwait", "false");

    Session session = Session.getDefaultInstance(props, new MyAuthenticator(userName, password));

    MimeMessage message = new MimeMessage(session);

    message.setFrom(new InternetAddress(from));

    message.addRecipient(Message.RecipientType.TO,
      new InternetAddress(to));

    message.setSubject("Hello JavaMail");

    message.setText("Welcome to JavaMail");

    Transport.send(message);
  }
}

class MyAuthenticator extends Authenticator
{
	private String userName;
	private String password;

	MyAuthenticator()
	{
		super();
	}

	MyAuthenticator(String userName, String password)
	{
		super();
		this.userName = userName;
		this.password = password;
	}

	protected PasswordAuthentication getPasswordAuthentication()
	{
		return new PasswordAuthentication(userName, password);
	}
}
but I got an Exception :
com.sun.mail.smtp.SMTPSendFailedException: 554 Message does not conform to standards
The mail server use MDaemon, and i think that it worked properly.
Please let me know how to solve this, thanks !
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2007
Added on Nov 24 2007
3 comments
718 views