[Helma-user] helma.Mail: debugging methods and smtp authentication

Robert Gaggl robert at helma.org
Mon Feb 19 11:39:01 CET 2007


Hi everybody,

out of a need for easier mail debugging and smtp authentication in 
helma.Mail i've added a few new methods to it which i'd like to propose 
here for a future release. The patch attached to this mail adds the 
following new methods:

1) setDebug(boolean): toggles debugging output of javax.mail. this is 
very useful as it logs the conversation with the smtp server to stdout
2) writeToFile([dir]): allows to write the mail as rfc 822 formatted 
source into a file. if no directory is passed as argument, the file is 
written in the temp-directory (defined in the system property 
"java.io.tmpdir")
3) getSource(): returns the wrapped message as rfc 822 formatted string
4) getMessage(): returns the wrapped MimeMessage instance
5) setAuthentication(username, password): if set the mail is sent using 
smtp authentication. for application- or system wide definition instead 
of calling this method define "smtp.username" and "smtp.password" in 
app- or server.properties

In addition the patch
- writes all error messages to event log (using app.logger.error) 
instead of using res.debug(). i couldn't find any hints whether using 
res.debug is just a leftover from the development phase or was chosen 
intentionally.
- adds the missing inline docs for addBCC

The patch also slightly changes the behaviour of send(): if no smtp host 
is given (either by setting the "smtp" in app- or server.properties file 
or by passing it to the helma.Mail constructor) the method writes the 
mail message into a file using writeToFile() together with an info 
message in event log. while imo this is useful esp. during development, 
i'm not sure if this should be the default behaviour.

Please let me know what you think about it.

robert
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Mail.js.patch
Url: http://helma.org/pipermail/helma-user/attachments/20070219/1bec846b/attachment.ksh 


More information about the Helma-user mailing list