1

I wrote a Salesforce email handler class in which I need to store the From address and later send emails to it. But I noticed that the from addresses were mangled for emails coming from my company.

Some investigation revealed that Salesforce was providing me the "Return-Path" header instead of the "From" header. Return-Path is where undeliverable messages are to be sent, not where human-generated replies are to be sent according to RFCs 3834 and 2821

These pieces of my headers look like this:

From: "Newman, Todd" <tnewman@illumina.com>
Return-Path: btv1==6821c02fcef==tnewman@illumina.com

The prepended string on the email comes from Barracuda, it's a part of SPF email security.

| improve this question | | | | |
1

I discovered that the From address provided by the InboundEmail is the correct "From" header. Meaning, InboundEmail provides the "From" header and InboundEnvelope provides the "Return-Path" header.

This contradicts the documentation which says both classes provide the From header value. (Envelope and Email)

I spent some time with Salesforce support on this. They insisted that the from value is being mangled by the sending server. This obviously doesn't makes sense. If it were true I wouldn't get different answers from the Envelope and Email classes. Also, nobody in the world would be able to reply to emails from our company.

So I'll put this out there in case someone else runs into the problem. Use .fromAddress from the Email object, not the Envelope object.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.