Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaMail - 554 Relay rejected for policy reasons.

John Fairbairn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting the following error "554 Relay rejected for policy reasons" when sending emails to an address outside of my company's domain (i.e.
Exception in thread "main" javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.SendFailedException: Invalid Addresses;
nested exception is:
javax.mail.SendFailedException: 554 Relay rejected for policy reasons.
at javax.mail.Transport.send0(
at javax.mail.Transport.send(
at com.canopyint.component.interop.smtp.EmailHelper.sendmail(EmailHelper
at com.canopyint.component.interop.smtp.EmailHelper.main(EmailHelper.jav
So, I can't send emails to or addresses. The mail server I'm using is Lotus Domino 5.0.8. I'm supplying the username and password when creating the session object but an not getting anywhere.
Here's my code:
Properties props = new Properties();
props.put( "mail.transport.protocol", strProtocol);
props.put( "", strHost );
props.put( "mail.user", getProperty("mail.username"));
props.put( "mail.password", getProperty("mail.password"));

System.out.println("Creating session...");
Session session = Session.getDefaultInstance(props, ea);
System.out.println("Created session...");
// Construct a MimeMessage
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress( EmailHelper.returnDefault(mail,"from") ) );
msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(EmailHelper.returnDefault(mail,"to"), false));
// -- set a CC: or BCC:
String cc = (String) mail.get("cc");
String bcc = (String) mail.get("bcc");
if (cc != null && (!cc.trim().equals(""))) msg.setRecipients(Message.RecipientType.CC, InternetAddress.parse(cc, false));
if (bcc != null && (!bcc.trim().equals(""))) msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(bcc, false));
msg.setSentDate(new Date());
System.out.println("Sending msg...");
// Send the message.

Thanks in advance for your assistance.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!