1835274 Members
2863 Online
110078 Solutions
New Discussion

Re: mailx

 
SOLVED
Go to solution
Joe Profaizer
Super Advisor

mailx

How do I send an mailx to a group of users? I presume there is a file that I insert email addresses into, then specify the filename somewhere in the mailx command.

Thanks
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor

Re: mailx

Hi Joe:

Try this:

for WHO in user1 user2 user3
do
mailx -s "hello there!" $WHO < /etc/hosts
done

...This would mail the /etc/hosts file to user1, user2 and user3 (the list). The subject of the mailing would read "hello there!".

...JRF...
A. Clay Stephenson
Acclaimed Contributor

Re: mailx

Hi Joe:
You need to create (or append to) the aliases file
- by default /etc/mail/aliases

Man aliases for the complete format details; it gives you everything you need.

Clay
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: mailx

Sorry Joe I signed off too quickly,
you then use the alias (or aliases) in place of the address argument in the mailx command.
Man mailx for those details.

Clay
If it ain't broke, I can fix that.