Revision: 7925 http://languagetool.svn.sourceforge.net/languagetool/?rev=7925&view=rev Author: dnaber Date: 2012-08-26 10:42:55 +0000 (Sun, 26 Aug 2012) Log Message: ----------- use try/finally; more verbose output when sending registration mail
Modified Paths: -------------- trunk/ltcommunity/grails-app/controllers/org/languagetool/UserController.groovy Modified: trunk/ltcommunity/grails-app/controllers/org/languagetool/UserController.groovy =================================================================== --- trunk/ltcommunity/grails-app/controllers/org/languagetool/UserController.groovy 2012-08-26 09:53:58 UTC (rev 7924) +++ trunk/ltcommunity/grails-app/controllers/org/languagetool/UserController.groovy 2012-08-26 10:42:55 UTC (rev 7925) @@ -132,7 +132,8 @@ String smtpHost = grailsApplication.config.smtp.host String smtpUsername = grailsApplication.config.smtp.user String smtpPassword = grailsApplication.config.smtp.password - props.put("mail.from", grailsApplication.config.registration.mail.from) + String fromAddress = grailsApplication.config.registration.mail.from + props.put("mail.from", fromAddress) props.put("mail.smtp.auth", true) Session session = Session.getInstance(props, null) MimeMessage msg = new MimeMessage(session) @@ -145,10 +146,13 @@ replaceAll("#USERID#", ticket.user.id + "")) msg.saveChanges() Transport tr = session.getTransport("smtp") - tr.connect(smtpHost, smtpUsername, smtpPassword); - tr.sendMessage(msg, msg.getAllRecipients()) - tr.close() - log.info("Mail sent to $toAddress") + try { + tr.connect(smtpHost, smtpUsername, smtpPassword); + tr.sendMessage(msg, msg.getAllRecipients()) + log.info("Mail sent to $toAddress via SMTP host $smtpHost, SMTP user $smtpUsername, From: $fromAddress") + } finally { + tr.close() + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Languagetool-cvs mailing list Languagetool-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-cvs