I need to mail all users on my shared hosting platform. I need to be able to do this on a regular basis. Any thoughts?

link|improve this question
Just all the local mail spools of all local users, or do they have external addresses you need to email? – Daniel DiPaolo May 6 '10 at 20:41
I don't see how this could be a programming question. I recommend serverfault.com – Gabe May 6 '10 at 20:50
feedback

migrated from stackoverflow.com May 6 '10 at 22:46

This question came from our site for professional and enthusiast programmers.

1 Answer

Maybe something like:

echo "message" | mailx -s "notify" `grep -v '#' /etc/passwd | cut -d : -f 1 | sed 's/\(.*\)/&@localhost/' | tr  '\n' ' '`

Mails message with subject notify to all local users in the system. You can add this to cron(1) and use different mail addresses from a file:

echo "message" | mailx -s "notify" `cat emaillist.txt`
link|improve this answer
feedback

Your Answer

 
or
required, but never shown