Mysterious Reply-To Header in Apple Mail

emailmail.app

I send e-mail with Apple Mail from two different accounts – lets call them A and B. Years ago I set the Reply-To header as my A account address (I think to force use of my 'canonical' address), since then I added my B account. Now all of my outgoing e-mail has the Reply-To header set to my A address. This causes considerable confusion to observant correspondents e-mailed through my B account. So, I'd like to fix this.

Here's where the mystery begins. I don't remember how I set the default Reply-To header. I would have thought that I would have used:

defaults write com.apple.mail UserHeaders ...

However

defaults read com.apple.mail UserHeaders

tells me "The domain/default pair of (com.apple.mail, UserHeaders) does not exist."

Next, I looked at the configuration on our e-mail provider, FastMail, to see if they might be setting a default Reply-To header. but I didn't see anything there.

Then, I tried resetting Apple Mail back to its default state using the instructions in How to reset mail to factory settings on discussions.apple.com. No dice.

And then, the method in How to Fix Mail App Not Working After macOS Update. Strike four.

Manually setting the header when I'm writing an e-mail doesn't work. The value I set gets overwritten, by the value for account A.

Where else could the header be set?

Best Answer

So with a bit of help the problem was tracked down to an interaction between SIP (System Integrity Protection), terminal, and Apple Mail.

Here's what was going on:

  • Due to SIP the Terminal app did not have access to Mail's defaults file: ~/Library/Containers/com.apple.mail/Data/Library/Preferences/com.apple.mail.plist
  • As a result, the defaults program was unable to read the defaults settings that Mail.app was actually using.
  • Instead of reporting an error when trying to access the com.apple.mail.plist it reported that the "The domain/default pair of (com.apple.mail, UserHeaders) does not exist."

The big clue was that defaults read com.apple.mail returned nothing.

The fix was to allow the Terminal.app full disk access in System Preferences (in Security & Privacy > Privacy > Full Disk Access). Then you restart Terminal.app.

After that defaults works as expected and

defaults delete com.apple.mail User-Headers

solved the problem – since I didn't have any other User-Headers set.