• Post Reply Bookmark Topic Watch Topic
  • New Topic

javamail help

 
Tum
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read how can coding jsp with javamail in
http://www.jspinsider.com/tutorials/jsp/javamail/jspjavamail_8.view
I have 2 question
1.
String toAddresses = request.getParameter("to");
message.addRecipients(Message.RecipientType.TO, toAddresses);
String ccAddresses = request.getParameter("cc");
message.setRecipients(Message.RecipientType.CC, ccAddresses);
String bccAddresses = request.getParameter("bcc");
message.setRecipients(Message.RecipientType.BCC, bccAddresses);

from this code, I don't know Why it swap from addRecipients() method to setRecipients() method.?
Why it not use addRecipients() all? Isn't setRecipients() replace all address that set privious in addRecipients() method?

2. this code
Message message = new MimeMessage(s);
Some example use this code but some example use this code
MimeMessage message = new MimeMessage(s);
I try both it and can send mail. What different in this 2 code?
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tum.
I would highly recommend you to use the mailer taglib, i've used it and I think it's even easier to understand.
check this link:
http://jakarta.apache.org/taglibs/doc/mailer-doc/mailer-1.0/index.html
besides,it is much cleaner to use inside a JSP page.
good luck.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!