• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

JavaMail Question

santana9

Banned
I need to send seperate messages so I can personalize each message with the specified friend name provided in a form. Here is my code for sending one message:

Properties props = new Properties();
props.put("mail.smtp.host", "ncsusraexmea1.na.jnj.com");
Session s = Session.getInstance(props,null);

MimeMessage message = new MimeMessage(s);

String from = request.getParameter("email1");
String yourname = request.getParameter("friend1");

String entireFrom = "\"" + yourname + "\" <" + from + ">";

message.setFrom(new InternetAddress(entireFrom));

String toAddresses = request.getParameter("email2");
message.addRecipients(Message.RecipientType.TO, toAddresses);

String toAddresses = request.getParameter("email3");
message.setRecipients(Message.RecipientType.CC, ccAddresses);

String bccAddresses = request.getParameter("email4");
message.setRecipients(Message.RecipientType.BCC, bccAddresses);

String subject = request.getParameter("subject");
message.setSubject(subject);


String text = request.getParameter("text");
String friendname = request.getParameter("friend2");
String entiretext = "Hello " + friendname + "," + "\n\n" + text;

message.setText(entiretext);

Transport.send(message);

Any help would be appreciated.
 
Back
Top