1751976 Members
4609 Online
108784 Solutions
New Discussion юеВ

Re: mail scripting

 
SOLVED
Go to solution
Leslie Fischer
Frequent Advisor

mail scripting

Hi,
Trying to script using the "mail" command to several user the contents of a file. Have no problem with the sending but want to include a Subject:
Have tried:
#mail someuser "subject title" < somefile.out
#mail someuser subject title< somefile.out (I get the email, but no subject line is included.

#mailx -u someuser -s"subject title" < somefile.out (rec the message"The flags you gave are used only when sending mail.")

Want to use mail command, but want to include a subject line. Tried getting info from man pages for mail, but I didn't see anything to include adding a "Subject:" on the command line. Can anyone help with the syntax?

4 REPLIES 4
Patrick Wallek
Honored Contributor
Solution

Re: mail scripting

# mailx -s "subject here" user1,user2,user3,user4 < somefile
Doug O'Leary
Honored Contributor

Re: mail scripting

Hey;

The -u option in mailx is a receive option only.

Try

cat ${file} | mailx -s"${subject}" ${list_o_addrs}

HTH;

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Leslie Fischer
Frequent Advisor

Re: mail scripting

Thank you..
Leslie Fischer
Frequent Advisor

Re: mail scripting

Closed