Sorry, I know it's pretty slow around here because of the holidays (and I'll be gone next week)... But I'd like to revisit this if possible...
I've been fumbling my way through java and made some vast improvements from yesterday. Using two java ext packages (javamail and jaf something), this cfx tag allows a user to send mail through an SMTP host that requires authorization. I've modified the source to add the CC and BCC fields and after recompiling they now work fabulously (although I still have a problem sending to multiple recipients in the "TO" field despite trying to play with that syntax as well, but multiples work fine in the other fields). Here is the bulk of the source... ************************************************** } String to = request.getAttribute("TO"); String cc = request.getAttribute("CC"); String bcc = request.getAttribute("BCC"); String from = request.getAttribute("FROM"); String subject = request.getAttribute("SUBJECT"); String message = request.getAttribute("MESSAGE"); String host = request.getAttribute("HOST"); String user = request.getAttribute("USER"); String password = request.getAttribute("PASSWORD"); //default port to 25 int port = 25; if(request.attributeExists("PORT")) { port = Integer.parseInt(request.getAttribute("PORT")); } Properties props = new Properties(); props.put("mail.smtp.host", host); props.put("mail.smtp.auth", "true"); Session session = Session.getDefaultInstance(props, null); try { // create a message Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(from)); InternetAddress[] address = { new InternetAddress(to) }; msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false)); if (cc != null) msg.setRecipients(Message.RecipientType.CC, InternetAddress.parse(cc, false)); if (bcc != null) msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(bcc, false)); msg.setSubject(subject); msg.setSentDate(new Date()); msg.setText(message); // send the message Transport tr = session.getTransport("smtp"); System.out.println(); tr.connect(host, port, user, password); msg.saveChanges(); tr.sendMessage( msg, msg.getAllRecipients() ); } catch (Exception sfx) { response.write("Mail send Failure! " + sfx.getMessage()); } response.write("Mail sent successfully."); } **************************************** So I pass the following parameters to it: **************************************** <CFX_AuthSMTP TO="#FORM.to#" FROM="#FORM.from#" SUBJECT="#FORM.subject#" CC="#FORM.cc#" BCC="#FORM.bcc#" TYPE="HTML" MESSAGE="#FORM.body#" HOST="#VARIABLES.SMTP_HOST#" PORT="#VARIABLES.SMTP_PORT#" USER="#VARIABLES.SMTP_USER#" PASSWORD="#VARIABLES.SMTP_PASS#"> ****************************************** My last issue is sending attachments. In the original version, they were uploaded and set with a cfmailparam tag before closing the CFMAIL tag: <CFLOOP INDEX="attachment" LIST="#FORM.attachments#" DELIMITERS=","> <CFMAILPARAM FILE="#VARIABLES.attachmentPath#/#attachment#"> </CFLOOP> I haven't the foggiest clue how to integrate them into the CFX tag with the source above. I realize none of you may be familiar with the custom tag I'm using, but do you have any hints/clues/starting points? Sorry to sound like such an ignorant slob, but I'm pretty thrilled I got as far as I did for an admin :-) Cathy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm