Send Email to all pop3 accounts

Hello,

I won't make a decision on this yet, but in the meantime, I've quickly written a simple script for you that can do it.

Create a mail.sh script with the following content
Code:
#!/bin/sh

for d in `cat /etc/virtual/domains`; do
{
        if [ ! -e /etc/virtual/$d/passwd ]; then
                continue;
        fi

        for u in `cat /etc/virtual/$d/passwd | cut -d: -f1`; do
        {
                echo "emailing $u@$d ...";
                /usr/sbin/exim $u@$d < msg.txt
        }
        done;
}
done;
and then create a msg.txt file with whatever email content you want, eg:
Code:
Subject: this is a mass notice

Hello,
    You've just received a mass email.
chmod the mail.sh to 755, then run it:
Code:
./mail.sh

John
 
Great work, John. Please consider posting this in the knowledgebase as well.

Thanks!

Jeff
 
oh gawd, PLEASE make sure that is NOT in a user accessible place - it should be owned by root only - not any user.

That COULD be a nightmare if exploited.
 
Back
Top