Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from May 6 '10 at 22:46

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

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

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`
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.