Hello,
I was using sun.net.smtp package to send out email
after adding a record to a table but since I cannot
set the content type to "text/html", so users who use
outlook are not seeing the message but instead are
seeing the actual html code. Due to this problem, I
am trying to use the javax.mail.* .
......
InternetAddress MailToAddress[] = new
InternetAddress[1];
MailToAddress[0] = new InternetAddress( toemail );
InternetAddress MailFromAddress = new
InternetAddress(from);
java.util.Properties props = new
java.util.Properties();
props.put("mail.smtp.host", "xyz");
MimeMultipart  mimeMultipart = new MimeMultipart();
MimeBodyPart textBodyPart = new MimeBodyPart();
StringBuffer sb = new StringBuffer();
sb.appen("<html><META HTTP-EQUIV=\"Content-Type\"
CONTENT=\"text/html;charset=iso-8859-1\"><body>");
sb.append("Subject: New Complaint");
sb.append("Complaint Number: " + c1cono);
sb.append("<center><b><font
color=\"#FF0000\"></b></center>");
sb.append("<div align=\"left\"><table border=\"0\"
width=\"100%\" bgco.....
......etc
textBodyPart.setContent(sb, "text/html");
                        mimeMultipart.addBodyPart(textBodyPart);
MimeMessage msg = new MimeMessage(
Session.getInstance(props, (Authenticator) null) );
msg.setFrom(MailFromAddress);
msg.setRecipients(Message.RecipientType.TO ,
MailToAddress);
msg.setContent(mimeMultipart);
msg.saveChanges();
Transport.send(msg);
out.println("<center><B>Message emailed out
successfully</center></B>");
}
catch(MessagingException mex) { out.println(mex);}

Now, I am not catching an exception, but I am not
getting an email. The message 'Message emailed out
successfully  is not being printed also'
Any suggestions?
Thanks,
JGM
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to