0

I have run into an issue this weekend with case sensitivity of headers in MailSendingMessageHandler. Are mail headers expected to be case sensitive in SI? A brief bit of research has led to me to discover that email headers in general should be insensitive (1).

Is this an oversight in SI or have I missed something obvious?

  1. Are email headers case sensitive?
Community
  • 1
  • 1

1 Answers1

0

The RFCs are talking about the headers that go over the wire (e.g. SMTP). The MailSendingMessageHandler receives a Spring Integration (SI) message and maps the SI headers to SMTP headers.

SI headers are case-sensitive.

For this reason (among others), we recommend using framework constants for the headers, instead of coding your own values.

For example

MailHeaders.FROM

in java or

#{T(org.springframework.integration.mail.MailHeaders).FROM}

in a SpEL expression specifying the header name.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • I'm already using the SpeL expression to map headers in an http:inbound-channel-adapter. I was hoping to use the SI MailHeader strings in the headers of an HTTP post into an SI app to allow clean throughput. I't seems the root cause of my problem is that the (Ruby) Http library I'm using to post s altering the case of my header keys. That combined with a conflict in my understanding of http case insensitivity and SI case sensitivity flagged the problem. No big deal, I guess now it just means that I have to implement my own header-mapper to check the case of the incoming header keys. – Chris Hedley Sep 10 '12 at 09:28