Click to See Complete Forum and Search --> : servlet question...


sanjuT
04-04-2005, 01:50 PM
i send e-mails like this:


// create some properties and get the default Session
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Session session = Session.getDefaultInstance(props, null);

try {
// create a message
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("intranet@abc.com"));

InternetAddress[] address = {new InternetAddress(email)};
InternetAddress[] carbon = {new InternetAddress("intranet@abc.com")};

msg.setRecipients(Message.RecipientType.TO, address);
msg.setRecipients(Message.RecipientType.CC, carbon);



msg.setSubject("Signage Request - Authorization Required");
msg.setSentDate(new Date());
// create and fill the first message part

msg.setText("Please click on the link (or copy and paste the link into your browser) http://abc/rfssno/sign" + rfssno + ".html\r\n\r\nPLEASE REMEMBER TO CLICK EITHER THE 'Approve' OR 'Deny' BUTTONS ON THE REQUEST PAGE." );

Transport.send(msg);
} catch (MessagingException mex) {
mex.printStackTrace();
Exception ex = null;
if ((ex = mex.getNextException()) != null) {
ex.printStackTrace();
}




How cn I send another e-mail with a different message? I tried repeating this block of code, but that didn't work. i probably implemented it incorrectly.

anyone know how i could do this?

thanks!

ray326
04-04-2005, 04:50 PM
Repeating that block in the try should work.