• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JavaMail - 554 Relay rejected for policy reasons.

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
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. bell.com):
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(Transport.java:219)
at javax.mail.Transport.send(Transport.java:81)
at com.canopyint.component.interop.smtp.EmailHelper.sendmail(EmailHelper
.java:149)
at com.canopyint.component.interop.smtp.EmailHelper.main(EmailHelper.jav
a:201)
.
So, I can't send emails to hotmail.com or yahoo.com 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( "mail.smtp.host", 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.setSubject(EmailHelper.returnDefault(mail,"subject"));
msg.setSentDate(new Date());
msg.setText(EmailHelper.returnDefault(mail,"body"));
System.out.println("Sending msg...");
// Send the message.
Transport.send(msg);

Thanks in advance for your assistance.
 
So there I was, trapped in the jungle. And at the last minute, I was saved by this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic