Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mailx recipients from ASCII file 1

Status
Not open for further replies.

Dbyte

Technical User
Mar 6, 2002
87
I have to send out a new user list (an ASCII file) to each new user that is on that same list via mailx, on the 1st of every month. This means that my recipient list must be generated from the file itself. How do I do this from the command line? The filename changes every month (thank you Admin), & I don't know anything about shell scripting. I'm just a newbie UNIX user who needs to get this done each month. Here are some examples of what I've tried:

mailx -s &quot;New employee list 12/03&quot; 'cat newlist' < newlist
mailx -s &quot;New employee list 12/03&quot; > cat newlist < newlist

Any help would be greatly appreciated,
-Dbyte
 

Why mailx? Do you access to PINE and assorted tools like FASTMAIL?


Anyway I think your first attempt

mailx -s &quot;New employee list 12/03&quot; 'cat newlist' < newlist

is the closest according to the man page but make sure you use

Back Quote ( ````` )

rather than

Straight quotes (''''')


mailx -s &quot;New employee list 12/03&quot; `cat newlist` < newlist

You might want to also consider adding a

-b &quot;yourself&quot;

I alway like to Blind copy myself on automatic mailings to make sure the script is functioning properly.

 
Tdatgod, you were absolutely correct. I just did a test run using a few personal e-mail addresses (in a file) & it worked fine. I've never used back quotes for anything in UNIX before, so that's something new to me.

Because I'm a newbie my resources are limited by the Sysadmin. As my knowledge increases I'll have access to more stuff (or so I'm told). Think of it as &quot;proactive damage control&quot;!

Thank you for your quick response - I really appreciate it.
 
Hi,
Back quotes mean execute the operation inside the quotes and put the output here as part of the command line.

 
Just another way...

#!/bin/sh
while read line
do
mailx -s &quot;New employee list 12/03&quot; $line < newlist
done < newlist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top