apache / apache/logging-log4j2

Add Support for Custom Headers in SMTP Appender

Open
#3,704 15 comments 0 reactions 1 assignee Claimed by @ramanathan1504 View on GitHub
appenders enhancement
Dominant language
Java
Stars
3.6k
Forks
1.7k
Avg merge
21h 30m
Merged PRs (30d)
27

Description

Currently, the [SMTP Appender](https://logging.apache.org/log4j/2.x/manual/appenders/network.html#SmtpAppender) does not support adding custom headers to outgoing email messages. In contrast, the [HTTP Appender](https://logging.apache.org/log4j/2.x/manual/appenders/network.html#HttpAppender) allows users to define custom headers using `` elements. Introducing similar support for the SMTP Appender would enhance feature parity across appenders and improve user experience and flexibility.

### Proposed Solution

Both the HTTP and SMTP Appenders extend `AbstractFilterable` and already support `` configuration elements. In the HTTP Appender, these `` elements are interpreted as HTTP headers. Similarly, the SMTP Appender could treat `` entries as custom email headers.

**Example:**

```xml




```

This change would preserve existing behavior while enabling greater customization for advanced email use cases.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.