• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to handle relay problems in JavaMail

 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

i'm currently trying to create a java program to send an email..

heres my code..

protected Forward sendEmail(SendEmailForm form)
{
Logger logger = LogManager.getLogger("Jacada.Debug.JFAP.SCRIPT");


try
{

//InitialContext ic = new InitialContext();
//Session session = (Session) ic.lookup("TestMail");

Properties props = new Properties();
props.put("mail.smtp.host","ourmailserver.com");
Session s = Session.getInstance(props);

MimeMessage message = new MimeMessage(s);

InternetAddress from = new InternetAddress("mymail@south.com");

message.setFrom(from);

InternetAddress to = new InternetAddress(form.getTxtTo());

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

message.setSubject(form.getTxtSubject());

message.setText(form.getTxtMessage());


Transport.send(message);


}
catch(Exception e)
{
if (logger != null)
logger.debug("***Mail Error " + e.getMessage());
return new Forward("error");
}


return new Forward("success");
}


problem is i can't send outside our domain.. thanks
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Discuss the problem with the person who administers your e-mail server. Either they can configure it so that you can relay (most likely from specific network addresses) or you will have to use authentication.
 
Cyrus Serrano
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot paul, will talk to my net admins..
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!