Customize your Mail.app Headers

It is possible to add custom headers to mails your are sending with Mail.app. You need to open and type the following commands. This is very useful to add headers with your mail priority, a default reply-to field or with your GnuPG or identity.

$ defaults write com.apple.mail UserHeaders '{
"X-GPG-URL" = "http://fred.velvnet.com/gnupg/3B487EE9.asc";
"X-GPG-Fingerprint" = "A906 101E 2CCD BB18 D7BD 09AE E7EA 02EC 3B48 7EE9";
}'

$ defaults write com.apple.mail UserHeaders '{
"X-GPG-URL" = "http://fred.velvnet.com/gnupg/3B487EE9.asc";
"X-GPG-Fingerprint" = "A906 101E 2CCD BB18 D7BD 09AE E7EA 02EC 3B48 7EE9";
}'


To read the content of your UserHeaders:
$ defaults read com.apple.mail UserHeaders

$ defaults read com.apple.mail UserHeaders


To delete the content of your UserHeaders
$ defaults delete com.apple.mail UserHeaders

$ defaults delete com.apple.mail UserHeaders


The command write will overwrite the existing content of UserHeaders. If you need to add a new field you must use the command read to see what fields are already defined and include them when your write the new field.
$ defaults read com.apple.mail UserHeaders
{
"X-GPG-Fingerprint" = "A906 101E 2CCD BB18 D7BD 09AE E7EA 02EC 3B48 7EE9";
"X-GPG-URL" = "http://fred.velvnet.com/gnupg/3B487EE9.asc";
}

$ defaults read com.apple.mail UserHeaders
{
"X-GPG-Fingerprint" = "A906 101E 2CCD BB18 D7BD 09AE E7EA 02EC 3B48 7EE9";
"X-GPG-URL" = "http://fred.velvnet.com/gnupg/3B487EE9.asc";
}


Now I cut and past the old fields and I insert the new field I want to define.
defaults write com.apple.mail UserHeaders '{
"X-GPG-Fingerprint" = "A906 101E 2CCD BB18 D7BD 09AE E7EA 02EC 3B48 7EE9";
"X-GPG-URL" = "http://fred.velvnet.com/gnupg/3B487EE9.asc";
"X-GPG-Keyserver" = "x-hkp://wwwkeys.us.pgp.net";
}'

defaults write com.apple.mail UserHeaders '{
"X-GPG-Fingerprint" = "A906 101E 2CCD BB18 D7BD 09AE E7EA 02EC 3B48 7EE9";
"X-GPG-URL" = "http://fred.velvnet.com/gnupg/3B487EE9.asc";
"X-GPG-Keyserver" = "x-hkp://wwwkeys.us.pgp.net";
}'


 

Leave a message

(Required)
(Required and not displayed)
(Optional)
obfuscated letters Enter the text shown in the image