nullPointerException on !_NEWLINE_!MimeMessage msg = new MimeMessage(mailSession);
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Jill_Lippert
Posted On:   Tuesday, May 29, 2001 01:27 PM

I'm trying to send a simple message and am getting npe on the above stmt.
Code snippet:

Properties mailSessionProps = new Properties();
mailSessionProps.put("mail.smtp.host", mailServer);

Session mailSession = Session.getInstance(mailSessionProps, null);

MimeMessage msg = new MimeMessage(mailSession);

don't get past here!
Help!!

Re: nullPointerException on !_NEWLINE_!MimeMessage msg = new MimeMessage(mailSession);

Posted By:   elango_maragtham  
Posted On:   Tuesday, May 29, 2001 08:04 PM

I have the same code snippet but it runs well ..
I have put my code here perhaps u can try this

Properties props = System.getProperties( ) ;
props.put("mail.smtp.host",mailserver);
props.put("mail.store.protocol","imap");
props.put("mail.transport.protocol","smtp");
Session session = Session.getDefaultInstance(props,null);
Message msg = new MimeMessage(session);
About | Sitemap | Contact