$ 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
To delete the content of your 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"; }
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"; }'