Operating System - Linux
1748123 Members
3285 Online
108758 Solutions
New Discussion юеВ

how to send a mail to all users

 
SOLVED
Go to solution
Maaz
Valued Contributor

how to send a mail to all users

MTA: Sendmail 8.x

I wana send a mail to all users that have email account.. is it possible ? how ?.
Please help.

Regards
Maaz
6 REPLIES 6
Ivan Krastev
Honored Contributor
Solution

Re: how to send a mail to all users

Maaz
Valued Contributor

Re: how to send a mail to all users

nice help ;)

regards
Maaz
Steven E. Protter
Exalted Contributor

Re: how to send a mail to all users

Shalom Maaz,

This solution is likely to blow up on any server that has number of recienets limited. This is a common anti-spam measure so that if a spammer finds a way to queue his/her junk, the server doesn't send it because spammers are greedy and want to send to 10000 recipients.

You may find it more practical to create a user list based on /etc/mail/virtusertable and use a for loop

while read -r recipeint
do
mail -s "service warning" $recipient
done < list

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Maaz
Valued Contributor

Re: how to send a mail to all users

Thanks SEP, and sory for repling late.

ok what I understand is I have to create a file, and past the code in the file and execute it ..ok
say
# vi mail.sh
while read -r recipeint
do
mail -s "service warning" $recipient
done < list

then
# ./mail.sh
right ?
now here I wana ask you that wahts "list" and "recepeint" ..

Regards
Maaz
Ivan Ferreira
Honored Contributor

Re: how to send a mail to all users

>>> now here I wana ask you that wahts "list" and "recepeint" ..

list is a file with the lists of mail accounts, and recipient is "one" account on each loop.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Steven E. Protter
Exalted Contributor

Re: how to send a mail to all users

Shalom,

Script looks good to me. Do make sure the part that sends the mail works right before running the script.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com