Email not working

F

francan00

I have this email method that worked about 2 months ago in my Web App.
It is located in Tomcat 4.1.27 on Windows 2000 server.
Today when I used it, it didnt send any emails and I got no error
messages on the web page. Where can I find out what the issue is or
why its not working?

public static void send(String smtpServer, String to, String from,
String body)
{
try
{
Properties props = System.getProperties();
props.put("mail.smtp.host", smtpServer);
Session session = Session.getDefaultInstance(props, null);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to,
false));
msg.setSubject("Test Mail thru java");
msg.setContent(body,"text/plain");
msg.setSentDate(new Date());
Transport.send(msg);
System.out.println("Email message.");
}
catch (Exception ex)
{
ex.printStackTrace();
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top