postfix

Ben Scott dragonhawk at gmail.com
Mon Aug 27 15:29:46 EDT 2007


On 8/27/07, Ken Campbell <kcampbell at conval.edu> wrote:
> Running postfix mail server and have an immediate need to email all users in
> domain. As postmaster, I have no address book. Is there a method to blanket
> email all users?

  If this is a traditional Unix mail setup, then you can do this:

unset maillist
cd /home
for user in * ; do
    maillist="$maillist -b $user "
done
echo mail -s 'Put your subject here' $maillist '' < /path/to/your/message

  The above will just print the proposed mail command, which is useful
for testing.  Remove the "echo" from before the "mail" command to
actually have the command execute.

  In this case, I define "traditional Unix mail setup" to be:

* all users have Unix accounts
* all users have home directories under /home
* only user home directories exist under /home
* home directory names match the usernames
* mail to bare usernames (no domain part) will be delivered

  The above conditions work for most Linux distributions, if you have
just been creating user accounts for each email address.  As Bruce
points out, if you're doing something different, you'll need to do
something different.

-- Ben


More information about the gnhlug-discuss mailing list