${siteName} Email Users Form
+ + + ++ + + +
likely viewing page " + originalReferer ); + } + + msgBuf.append(lineSeparator + "
BLANK MESSAGE
"); + } else { + msgBuf.append(""+comments+"
"); + } + msgBuf.append("" + lineSeparator ); + msgBuf.append("" + lineSeparator ); + + String msgText = msgBuf.toString(); + // debugging + //PrintWriter outFile = new PrintWriter (new FileWriter(request.getSession().getServletContext().getRealPath("/WEB-INF/LatestMessage.html"),true)); //autoflush + + Calendar cal = Calendar.getInstance(); + + /* outFile.println(""+cal.getTime()+"
"); + outFile.println(); + if (probablySpam) { + outFile.println("REJECTED - SPAM
"); + outFile.println(""+spamReason+"
"); + outFile.println(); + } + outFile.print( msgText ); + outFile.println(); + outFile.println(); + outFile.flush(); + // outFile.close(); + */ + // Set the smtp host + Properties props = System.getProperties(); + props.put("mail.smtp.host", smtpHost); + Session s = Session.getDefaultInstance(props,null); // was Session.getInstance(props,null); + //s.setDebug(true); + try { + // Construct the message + MimeMessage msg = new MimeMessage( s ); + //System.out.println("trying to send message from servlet"); + + // Set the from address + msg.setFrom( new InternetAddress( webuseremail )); + + // Set the recipient address + + if (recipientCount>0){ + InternetAddress[] address=new InternetAddress[recipientCount]; + for (int i=0; i