Operating System - Linux
1827862 Members
2404 Online
109969 Solutions
New Discussion

Re: mail command and email header...

 
K.C. Chan
Trusted Contributor

mail command and email header...

All,
does any know how to embed email header like 'X-script: $0" vi mail command?

Thanks.
Reputation of a thousand years can be determined by the conduct of an hour
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: mail command and email header...

Shalom KC

Most of what is the header is based on system configuraiton and sendmail.cf configuration.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Joel Girot
Trusted Contributor

Re: mail command and email header...

Hi
for modify the header, i add this lines on my /etc/mail sendmail.mc AND /etc/mail/submit.mc sendmail configuration files.

define(`confRECEIVED_HEADER', `from smtp1.mydomain.fr
by smtp1.mydomain.fr $?r with $r$. id $i$?u
for $u; $|;
$.$b')dnl
define(`confMESSAGEID_HEADER', `<$t.$i@smtp1.mydomain.fr>')dnl

Hope this help you,

Joel
Stuart Browne
Honored Contributor

Re: mail command and email header...

The changes Joel suggests will add that header to all mails that go out.

You only want to add this header to mails that you're generating from a script and are piping through the 'mail' command, right?

Using 'mail', you can't. It just isn't designed for that.

So, what are your options? Really, not that many.

Two I can think of off the top of my head.

1) Make a file 'script.muttrc', and use 'mutt -F script.muttrc -s "" ' in place of 'mail -s "" '. Put the line:

my_hdr X-Script: scriptname

in the 'script.muttrc' file.

2) Create the entire message and header structure outside of any mail program, with customized header lines etc. in it, and shove the entire thing through 'sendmail -bt '.

Just some mthoughts.
One long-haired git at your service...
zsolt_1
New Member

Re: mail command and email header...

Hi all!

I have a question. I add a custom header to my e-mails, and set up the return-path. The question would be that if the mail doesn't go to the recipient and it is returned at the return adress than is it possible to lose my header or i'll get the mail exactly as i'll sent it???

With respect Zsolt.