Is it possible to set an SMTP header in SMTPAppender?

144 views Asked by At

I've got an SMTPAppender configured and I'd like to have email messages sent by that appender to have the header Auto-Submitted: auto-generated added to the messages. (This allows auto-responders, for example, to stop sending out-of-office messages to auto-generated error messages).

I don't see anything in the log4j 1.2.x API to handle this kind of thing. Is it possible to do with the existing library? If not, is it possible with a little extra hacking?

1

There are 1 answers

0
Christopher Schultz On BEST ANSWER

It seems as if this capability isn't available with log4j (at least the 1.x line) out of the box.

I've created a class that will do this through configuration. It can be found on GitHub here: org/apache/log4j/extras/ExtendedSMTPAppender.java