0

I have to write a shell script using a here document that will send a personalized greeting email to each student on a mailing list. I am using following script to sent mail to individual users:

$ cat > here.sh
mail $1 << endoftext
Dear $1
Welcome to the Unix Class
-$USER
endof text

I am new to Unix so am not able to create mailing list.

Any help is really appreciated.

3
  • ...although this sounds like homework. Jul 15, 2011 at 17:41
  • @David it reeks of homework :-)
    – voretaq7
    Jul 15, 2011 at 18:06
  • It smells like stack overflow homework, too...
    – womble
    Jul 15, 2011 at 22:56

1 Answer 1

1

Method 1: Create an alias in your mail system's alias file (/etc/aliases or /etc/mail/aliases is usually the right spot), and use it do direct email to the addresses that should be on your list. Manage by editing (and recompiling) the aliases list / database. Refer to the man page for the aliases file and your MTA documentation for additional information.

Method 2: Install some mailing list software.
Manage in accordance with the documentation provided.

Note that you will need root access in order to implement either of these solutions, however implementing (2) typically allows non-root users to be mailing list managers, and is a much preferred solution.

Not the answer you're looking for? Browse other questions tagged .