Fixed compile error
This commit is contained in:
parent
a005d26f1c
commit
dbafad9e9e
1 changed files with 32 additions and 32 deletions
|
@ -174,41 +174,41 @@ public class ContactMailController extends FreeMarkerHttpServlet {
|
||||||
FileWriter fw = new FileWriter(context.getRealPath(EMAIL_BACKUP_FILE_PATH),true);
|
FileWriter fw = new FileWriter(context.getRealPath(EMAIL_BACKUP_FILE_PATH),true);
|
||||||
PrintWriter outFile = new PrintWriter(fw);
|
PrintWriter outFile = new PrintWriter(fw);
|
||||||
writeBackupCopy(outFile, msgText, spamReason);
|
writeBackupCopy(outFile, msgText, spamReason);
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
|
||||||
|
if (spamReason == null) {
|
||||||
|
sendMessage(s, webuseremail, deliverToArray, deliveryfrom,
|
||||||
|
recipientCount, msgText);
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (AddressException e) {
|
||||||
|
statusMsg = "Please supply a valid email address.";
|
||||||
|
outFile.println( statusMsg );
|
||||||
|
outFile.println( e.getMessage() );
|
||||||
|
} catch (SendFailedException e) {
|
||||||
|
statusMsg = "The system was unable to deliver your mail. Please try again later. [SEND FAILED]";
|
||||||
|
outFile.println( statusMsg );
|
||||||
|
outFile.println( e.getMessage() );
|
||||||
|
} catch (MessagingException e) {
|
||||||
|
statusMsg = "The system was unable to deliver your mail. Please try again later. [MESSAGING]";
|
||||||
|
outFile.println( statusMsg );
|
||||||
|
outFile.println( e.getMessage() );
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
outFile.flush();
|
||||||
|
outFile.close();
|
||||||
}
|
}
|
||||||
catch (IOException e){
|
catch (IOException e){
|
||||||
LOG.error("Can't open file to write email backup");
|
LOG.error("Can't open file to write email backup");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 {
|
|
||||||
|
|
||||||
if (spamReason == null) {
|
|
||||||
sendMessage(s, webuseremail, deliverToArray, deliveryfrom,
|
|
||||||
recipientCount, msgText);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (AddressException e) {
|
|
||||||
statusMsg = "Please supply a valid email address.";
|
|
||||||
outFile.println( statusMsg );
|
|
||||||
outFile.println( e.getMessage() );
|
|
||||||
} catch (SendFailedException e) {
|
|
||||||
statusMsg = "The system was unable to deliver your mail. Please try again later. [SEND FAILED]";
|
|
||||||
outFile.println( statusMsg );
|
|
||||||
outFile.println( e.getMessage() );
|
|
||||||
} catch (MessagingException e) {
|
|
||||||
statusMsg = "The system was unable to deliver your mail. Please try again later. [MESSAGING]";
|
|
||||||
outFile.println( statusMsg );
|
|
||||||
outFile.println( e.getMessage() );
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
outFile.flush();
|
|
||||||
outFile.close();
|
|
||||||
|
|
||||||
// Message was sent successfully
|
// Message was sent successfully
|
||||||
if (statusMsg == null && spamReason == null) {
|
if (statusMsg == null && spamReason == null) {
|
||||||
bodyTemplate = "commentForm/confirmation.ftl";
|
bodyTemplate = "commentForm/confirmation.ftl";
|
||||||
|
|
Loading…
Add table
Reference in a new issue