Skip to Content
0
Former Member
Jan 08, 2008 at 12:19 PM

cann't access to mail server or send email

50 Views

Hi, everyone I developed a Java progam on EP to send an email to one of our EP users. It worked fine before. Since this year our mail server has been changed. The old access path to the server was something like com1.com2.com3.net, the current one is smtprelay.com.net. In the code I just replaced the old one by the new one and the progam doesn't send email. The rest of the surce code works well and can be monitored in the log.

Here is the code snipet. Any hint to fix this tricky problem ? Thanks in advanced.

//Set the host smtp address

Properties props = new Properties();

// previous

// props.put("mail.smtp.host", "com1.com2.com3.net");

// current

props.put("mail.smtp.host", "smtprelay.com.net");

Session session = Session.getDefaultInstance(props,null);

javax.mail.Message msg = new MimeMessage(session);

javax.mail.Message msg1 = new MimeMessage(session);

InternetAddress addressFrom;

addressFrom = new InternetAddress("Intraweb");

msg.setFrom(addressFrom);

InternetAddress addressTo = new InternetAddress(recipient);

msg.setRecipient(javax.mail.Message.RecipientType.TO,addressTo);

// notify_subject

msg.setSubject("test string");

msg.setContent(log, "text/html");

msg.setSentDate(new GregorianCalendar().getTime());

Transport.send(msg);

Kind regards.

Wang