Hi Florian,
> how can i quickly send an email to all local users from the shell (while
> getting the mail body from a file)?
Here is a quick and dirty way of doing that:
RaQ550 / BlueQuartz:
====================
Through the GUI create user "mailall".
Then run this command from SSH as root:
ls -Al /home/sites/*/users/*/mbox | gawk {'print "\\"$9'} | sed 's~/mbox~~' |
sed 's~/home/sites/.*/~~' > ~mailall/.forward
All in one line!
Depending on your Sendmail configuration you may have to fix the UID and GID
of the created file mailall/.forward, though. It should be owned by the
user 'mailall' and have the GID of the site that he belongs to.
What the command does:
It reads the directory (or directories on the RaQ550) where the mailbox files
or your users are located and it finds out what mailboxes exist in there. It
then creates a .forward file in ~mailall with a list of all mailbox owners.
When you then send an email to user "mailall" on your server, then
the .forward file will make sure that the mail is forwarded to ALL users that
exist on the server.
IMPORTANT recommendation:
==========================
1.) When you use this method, put the address "mailall at yourdomain.com" into
the BCC (Blind Carbon Copy) recipient box so that recipients do NOT see
the "mailall" email address.
2.) Once you sent the mail to all users, delete or rename the .forward file
(!!!). You do NOT want that anyone else than you can send mail to all your
users in one go. Imagine a competitor or spammer sending an email to that
address. Or one customer sending mail to the address and all other users then
also get that mail.
So use this one with great care and remove the "mailall"-user and/or
the .forward file as soon as you are done with your mailing run.
--
With best regards,
Michael Stauber