getting To: from a file for sendmail or mailx?
Hi group,
I need to control sendmail or mailx from a file. The file will have the receprent as the first line, Subject: has the second line, etc. From what I can find with Google the only why to define the target and subject is on the command line? Does any one know of a way to make a mailer use the data in a file?? The file would look like this: Code:
me@mydomain.com |
getting To: from a file for sendmail or mailx?
From the command line you could use head -n 1 <file> for the address and sed -n 2p <file> to send your file from the command line
|
Ah! Good point tc1280.
Assuming the file is named file, the address is on line 1, the subject is on line 2, and the message body is line 3 to the end, try this: Code:
sed 1,2d file | mailx -s "$(sed -n 2p file)" "$(sed 1q file)" |
All times are GMT -5. The time now is 06:00 AM. |