Custom email headers in sendmail and postfix.
- December 13th, 2012
- Posted in Documentation
- Write comment
Sendmail:
# cd /etc/mail
# vi /submit.mc
ā¦
LOCAL_CONFIG
HX-MyCustomHeader: MyCustomHeaderValue
ā¦# m4 submit.mc > submit.cf
# service sendmail restart
Postfix:
# cd /etc/postfix
Note: In the master.cf, only the -o (options) line was added.
# vi master.cf
ā¦
smtp unix ā ā n ā ā smtp
-o smtp_header_checks=regexp:/etc/postfix/mycustomheaders
ā¦
Create a file to store your custom headers.
# vi mycustomheaders
/^Subject:.*/ PREPEND X-MyCustomHeader: MyCustomHeaderValue# service postfix restart
How too add User ID, in custom header?
I am not sure how to do this offhand. However, if you mean the sender user name, I have seen the authentication name in the header is some messages.
@ Jgz
I meant, something like this ā X-User-ID: 512
Iām using postfix
I will a little explain, on the server there are some users, and I want add custom header, which will show ID of the user who sent the letter. But here is how to add the user ID in the custom header?
How about this if using SASL?
/etc/postfix/main.cf:
smtpd_sasl_authenticated_header = yes
Thank You very much Joz, it partially solved my problem