Re: Send service email to all my users?

From: Ted Fines (no email)
Date: Mon Jun 30 2003 - 12:02:34 EDT


Can you generate a list of your users?

Once you have that, a simple Perl program could be used to send them each a
message, using the Perl Mail::Sender module. Here's a snippet of a Perl
program we use to send mass email:

Just get your list of users and put it into the '@list_of_all_userids'
array and they'll all get mailed.

#!/bin/perl -w
use Mail::Sender;
my $c=0;
my $sleep_time=60;
my $emails_between_sleep=100;

foreach my $userid (@list_of_all_userids) {
    $c += 1;
    &mail_it($userid);
    if ($c > $emails_between_sleep) {
        # so the mail server doesn't get killed
        sleep $sleep_time;
        $c = 0;
    }
}
sub mail_it {
my ($to) = @_;
my $mailhost='your.smtp.server';
my $from = '';
my $subject = 'Some kind of subject';
my $body = 'This is the message body.';
my $file = '/path/to/attachment';

$sender = new Mail::Sender {
                            smtp => $mailhost,
                            from => $from
                           };
$sender->MailFile({
                   to => $to,
              subject => $subject,
                  msg => $body,
                 file => $file
                 });
}

--On Monday, June 30, 2003 4:17 PM +0100 Dave Carrera <>
wrote:

> Hi All
>
> New to administrating a email server so I beck your kindness if this is a
> simple question.
>
> I have about 3000 users of which I wish to send them an email notifying
> them of some downtime.
>
> How do I do that?
>
> Server is FreeBSD 4.7 / Postfix / Cyrus
>
> Thank you for any help in advance
>
> Dave C
>
> http://www.ephgroup.com
> Secure Hosting Accounts for everyone.
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.493 / Virus Database: 292 - Release Date: 25/06/2003
>
>
>








Hosted Email Solutions

Invaluement Anti-Spam DNSBLs



Powered By FreeBSD   Powered By FreeBSD