Hi All, I have the following method to send a confirmation email message from within a web app which is working. I would like to send the message to 3 or 4 different email addresses. Could anyone provide the format for the Bcc Ccc recipients or any other way of sending it to multiple people?
// method to send an e-mail via SMTP // (if no authentication is required from the mailserver) boolean loggedIn = getLoggedIn();
String from = "w...@woo.com"; String to = email+",c...@woo.com"; String mailserver = "mail.woo.com";
log("To address is: "+to); log("About to try and Email details: To: "+email+" Firstname: "+name);
try { log("In the Email try"); SmtpClient client = new SmtpClient( mailserver ); log("Got client");
client.from(from); client.to(to);
log("Set the client from and to - About to create the print stream");
java.io.PrintStream message = client.startMessage(); log("Started message"); message.println("To: " + to); // TODO: set the subject line message.println("Subject: Order Details - Woo Widgets Order"); // TODO: set the body of the message
message.println("Hello "+name+",\nThanks for your order with Focal Point Furniture Online.\n\nPlease check that the following information is correct and keep this Email for your records.\n\n"); message.println("Your Name: " +name+"\n"); message.println("YourAddress: " + address+"\n"); message.println("Your Order ID is: " +orderInfoID+"\n\n"); message.println("Your Order detail: " +basket+"\n\n");
if (loggedIn){ message.println("If any of these details are incorrect please log in to http://www.woo.co.uk to ammend.\nThanks for your order.\n\nRegards,\nJames Woowoo");
}else{
message.println("If any of these details are incorrect please telephone 01573228393 or Email correctOr...@woo.co.uk to rectify.\nThanks for your order.\n\nRegards,\nJames Woo"); }
client.closeServer(); log("Confirmation message is sent!!!"); } catch (java.io.IOException ex) {
// in the case of an exception, print a message to the output log log("ERROR SENDING EMAIL:"+ex);