Implementation of the SMTPAppender on Windows platforms

Details

Description

SMTPAppender is implemented with the libsmtp library. This library supports only POSIX platforms.
SMTPAppender should compile with libsmtp on Windows/cygwin but not on Windows/Visual Studio 6 and 7.1
SMTPAppender could be have a specific implementation on Windows/Visual Studio by using the Microsoft CDO library.

Activity

SMTPAppender appears to be non-functional and has not been updated for the unicode changes that occurred a couple of years ago.

My current thought would be to branch log4j's SMTPAppender to use Commons Net's SMTPClient (http://commons.apache.org/net/). Then port the branched appender and the necessary parts of SMTPClient implemented on top of APR plus the SMTP test cases.

Curt Arnold
added a comment - 14/Nov/07 05:58 SMTPAppender appears to be non-functional and has not been updated for the unicode changes that occurred a couple of years ago.
My current thought would be to branch log4j's SMTPAppender to use Commons Net's SMTPClient ( http://commons.apache.org/net/ ). Then port the branched appender and the necessary parts of SMTPClient implemented on top of APR plus the SMTP test cases.

Rev 601193 eliminated the use of the Windows style _T and T2A macros and brought the appender in-line with big Unicode change from several years ago and now compiles (with manual hacks to the configuration to enable SMTP) but has linking issues that have not been addressed.

libsmtp appears to be dormant, is not available packaged (at least for Ubuntu) and has problems building with the latest gcc's. libesmtp appears to be functionally similar and is packaged for Ubuntu. Both are LGPL. My next effort will be to migrate from libsmtp to libesmtp.

CDO appears to be a seriously different beast and appears to be deprecated. I expect getting libesmtp working on Windows would be simpler than working with CDO.

Commons-NET was not feature complete enough to replace the use of the JavaMail API in log4j's implementation, so the idea of porting it to have a minimal cross-platform lib isn't viable.

The configure.in doesn't update the LOG4CXX_HAVE_SMTP which is hardcoded to 0 regardless of any --with-SMTP value. When this is all played out, some changes will need to be made there.

Curt Arnold
added a comment - 05/Dec/07 03:14 Rev 601193 eliminated the use of the Windows style _T and T2A macros and brought the appender in-line with big Unicode change from several years ago and now compiles (with manual hacks to the configuration to enable SMTP) but has linking issues that have not been addressed.
libsmtp appears to be dormant, is not available packaged (at least for Ubuntu) and has problems building with the latest gcc's. libesmtp appears to be functionally similar and is packaged for Ubuntu. Both are LGPL. My next effort will be to migrate from libsmtp to libesmtp.
CDO appears to be a seriously different beast and appears to be deprecated. I expect getting libesmtp working on Windows would be simpler than working with CDO.
Commons-NET was not feature complete enough to replace the use of the JavaMail API in log4j's implementation, so the idea of porting it to have a minimal cross-platform lib isn't viable.
The configure.in doesn't update the LOG4CXX_HAVE_SMTP which is hardcoded to 0 regardless of any --with-SMTP value. When this is all played out, some changes will need to be made there.

Rev 603118 is an initial implementation of SMTPAppender based on libesmtp. Use of libesmtp must be enabled using:

./configure --with-SMTP=libesmtp

Supporting non US-ASCII characters would require integrating a MIME library (best candidate looks like libgmime-2 also LGPL'd), however it is likely better to accept loss of non US-ASCII characters for a hopefully simpler time getting SMTPAppender working on Windows.

SMTPAppender has been synchronized with log4j's and supports to, cc, bcc, smtpUsername and smtpPassword options.

Simple tests have been done posting both with and without password authentication.

enabling libesmtp in the Ant build will likely be done when attempting to build on Windows.

Curt Arnold
added a comment - 11/Dec/07 02:19 Rev 603118 is an initial implementation of SMTPAppender based on libesmtp. Use of libesmtp must be enabled using:
./configure --with-SMTP=libesmtp
Supporting non US-ASCII characters would require integrating a MIME library (best candidate looks like libgmime-2 also LGPL'd), however it is likely better to accept loss of non US-ASCII characters for a hopefully simpler time getting SMTPAppender working on Windows.
SMTPAppender has been synchronized with log4j's and supports to, cc, bcc, smtpUsername and smtpPassword options.
Simple tests have been done posting both with and without password authentication.
enabling libesmtp in the Ant build will likely be done when attempting to build on Windows.

Some months ago I've implemented SMTPAppender using CDO for a test. Now I updated the implementation to the current SVN Revision (680327). I submit a patch log4cxx-1.2.patch. Enable SMTPAppender using CDO with -Dwith-SMTP=CDO.

Michael Waeber
added a comment - 28/Jul/08 17:30 Some months ago I've implemented SMTPAppender using CDO for a test. Now I updated the implementation to the current SVN Revision (680327). I submit a patch log4cxx-1.2.patch. Enable SMTPAppender using CDO with -Dwith-SMTP=CDO.
Tested with ant build, MSVC 8.0 on Windows XP.

Michael Waeber
added a comment - 28/Jul/08 17:35 For a test I need a SMTPAppender which sends all messages written to a special logger as email. So I implemented the SendAllEvaluator (patch log4cxx-1.3.patch).
Enable with
log4j.appender.SPECIAL_LOGGER.evaluatorClass=org.apache.log4j.net.SendAllEvaluator
in property file