code works fine with no exception.but message is not sent
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Radhakrishnan_Chellappen
Posted On:   Wednesday, May 30, 2001 09:22 AM

i got the code working fine with no exceptions . (i am catching the exception and logging it.)but message is not sent to the email address. what could be the problem ?. Here is the code.SMTP mail server is running in my local machine. please help me props.put("mail.smtp.host", "localhost" ); sess = javax.mail.Session.getDefaultInstance(props, null); sess.setDebug( Boolean.valueOf( "false" ).booleanValue() ); int i = 0; MimeMessage msg = new MimeMessage(sess); msg.setFrom(new InternetAddress( "xyz")); msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject( "Test Mail"); /*MimeBodyPart mbp1    More>>

i got the code working fine with no exceptions . (i am catching the exception and logging it.)but message is not sent to the email address.
what could be the problem ?. Here is the code.SMTP mail server is running in my local machine. please help me

props.put("mail.smtp.host", "localhost" );
sess = javax.mail.Session.getDefaultInstance(props, null);
sess.setDebug( Boolean.valueOf( "false" ).booleanValue() );

int i = 0;
MimeMessage msg = new MimeMessage(sess);

msg.setFrom(new InternetAddress( "xyz"));


msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject( "Test Mail");


/*MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText( "Test Mail Sucess" );

Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);

if ( ! mailAttachments.isEmpty() )
//MimeBodyPart mbp2 = new MimeBodyPart();


msg.setContent(mp);*/
msg.setText("Hai This is a test mail");

msg.setSentDate(new Date());

Transport.send(msg);

   <<Less
About | Sitemap | Contact