-
-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multiple headers with same key #289
Comments
Hi, sorry for the late reply, this report slipped away from me I think. So you might not need this anymore, but I would like to explore your use case a bit. I can't think of a situation where you would want duplicate headers with different values. I'm not even sure those headers are maintained when sending and reading them back. Can you shed some light on this, please? |
Hello, I've worked around the issue for now, but it would still be a nice to have. Duplicate headers are maintained through the SMTP transmission process (eg: the "Received" header), so it's certainly a valid use case. However, in my scenario, we're using an ESP (Email Service Provider), mailgun in this case, that allows us to provide additional tags/metadata on emails we send via their SMTP gateway for analytics purposes. The header form is basically: "X-Mailgun-Tag: ", with multiple tags specified by simply duplicating the header key and providing different values. I suspect other ESPs may also have functionality that operates similarly. |
Indeed the RFC allows for duplicate optional-field headers, which means any header name other than then ones specified by the RFC. |
Released in 6.5.0 |
I've run into a situation where I need to be able to apply several headers with the same key to an email, but it seems that the internals for adding headers to an email is defined as a Map, which precludes duplicates.
Is there a way to add the same header multiple times with different values?
Perhaps making the value of EmailBuilder.withHeader() accept a List as the second argument, which would get converted into the same header repeated for each item in the list?
The text was updated successfully, but these errors were encountered: