Help about sending over 1000 mails error!! 
Author Message
 Help about sending over 1000 mails error!!

Sounds like an O/S problem, more specifically a unix problem.


Quote:
> Hi

> My work is maintaining a site, and I am trying to
> send HTML based mails to my mailing list by MIME::Lite
> module when my site have some updates.

> However, My codes seem run not very good, it returns
> some error messages when sending over 300 or sometimes
> 200 mails out:

> Can't open /dev/null: Too many open files in system

> and sometimes

> /usr/lib/sendmail: error in loading shared libraries: libdb.so.3: cannot
> open sh
> ared object file: Error 23
> open |/usr/lib/sendmail -t -oi -oem: Too many open files in system

> ==============================================
> use MIME::Lite;

> my $FILE_SRC='mail_list.txt';

> open(HTMLSRC, "<update.htm");
>  undef $/; $HTML=<HTMLSRC>; $/="\n";
> close(HTMLSRC);

> $cnt = 0;
> open(MAILS, "<$FILE_SRC");

> while (<MAILS>){
>  chomp;
>   $cnt++;
>   &send_mail("$_");

> if (not $cnt%100) {
>                 $thou = $cnt/100;
>                 print $thou."00 mails over\n";
>         }
> }

> close(MAILS);

> print "Total $cnt emails sent.\n";

> sub send_mail{
>  $recipient = $_[0];
>  $msg = MIME::Lite->new(
>  From =>"$send_from",
>  To       =>"$recipient",
>  Subject  =>'Update news',
>  Type     =>'multipart/related'
>  );

>  $msg->attach(
>  Type => 'text/html',
>  Data => qq{ $HTML }
>  );

>  $msg->send;
> }

> ======================================

> Could somebody tell me where I am going wrong?
> thanks very very much.



Wed, 18 Jun 1902 08:00:00 GMT  
 Help about sending over 1000 mails error!!

Quote:

>Sounds like an O/S problem, more specifically a unix problem.

Sounds more like a file descriptor leak to me.

Also, sounds like the original poster is trying to invoke
/usr/lib/sendmail 1000 times, which is really not necessary since you
can open up an SMTP session (using Net::SMTP) and send several
(hundreds of) messages over that same session.

Or, I believe Mail::Internet objects have a smtpsend() method.

Another option is to look at Mail::BulkMail.

Yet another possibility is that the original poster doesn't want to
send a zillion separate mail messages, but instead wants to send a
single mail message to a zillion users.  This will be more efficient
anyway, especially if there are recipients who receive mail on the same
server, since only one copy must be sent instead of several.  In that
case, the easiest method is to construct a message (with whatever
headers you like), open up a Net::SMTP session, and then specify a
zillion addresses when calling the recipient() method.

Of course, info on all these modules can be found at
http://search.cpan.org/ .

  - Logan



Wed, 18 Jun 1902 08:00:00 GMT  
 Help about sending over 1000 mails error!!
Hi

My work is maintaining a site, and I am trying to
send HTML based mails to my mailing list by MIME::Lite
module when my site have some updates.

However, My codes seem run not very good, it returns
some error messages when sending over 300 or sometimes
200 mails out:

Can't open /dev/null: Too many open files in system

and sometimes
/usr/lib/sendmail: error in loading shared libraries: libdb.so.3: cannot
open sh
ared object file: Error 23
open |/usr/lib/sendmail -t -oi -oem: Too many open files in system

==============================================
use MIME::Lite;

my $FILE_SRC='mail_list.txt';

open(HTMLSRC, "<update.htm");
 undef $/; $HTML=<HTMLSRC>; $/="\n";
close(HTMLSRC);

$cnt = 0;
open(MAILS, "<$FILE_SRC");

while (<MAILS>){
 chomp;
  $cnt++;
  &send_mail("$_");

if (not $cnt%100) {
                $thou = $cnt/100;
                print $thou."00 mails over\n";
        }

Quote:
}

close(MAILS);

print "Total $cnt emails sent.\n";

sub send_mail{
 $recipient = $_[0];
 $msg = MIME::Lite->new(
 From =>"$send_from",
 To       =>"$recipient",
 Subject  =>'Update news',
 Type     =>'multipart/related'
 );

 $msg->attach(
 Type => 'text/html',
 Data => qq{ $HTML }
 );

 $msg->send;

Quote:
}

======================================

Could somebody tell me where I am going wrong?
thanks very very much.



Fri, 02 May 2003 01:06:08 GMT  
 Help about sending over 1000 mails error!!
Thanks..

It seems a system problem of RedHat6.2

I copy the script to run under RedHat5.2, it works fine.



Quote:


> >Sounds like an O/S problem, more specifically a unix problem.

> Sounds more like a file descriptor leak to me.

> Also, sounds like the original poster is trying to invoke
> /usr/lib/sendmail 1000 times, which is really not necessary since you
> can open up an SMTP session (using Net::SMTP) and send several
> (hundreds of) messages over that same session.

> Or, I believe Mail::Internet objects have a smtpsend() method.

> Another option is to look at Mail::BulkMail.

> Yet another possibility is that the original poster doesn't want to
> send a zillion separate mail messages, but instead wants to send a
> single mail message to a zillion users.  This will be more efficient
> anyway, especially if there are recipients who receive mail on the same
> server, since only one copy must be sent instead of several.  In that
> case, the easiest method is to construct a message (with whatever
> headers you like), open up a Net::SMTP session, and then specify a
> zillion addresses when calling the recipient() method.

> Of course, info on all these modules can be found at
> http://search.cpan.org/ .

>   - Logan



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Sending mail under Cygwin using Mail::Send perl module

2. DBD/DBI for informix on DEC 1000

3. Perl PL8 on 3B2/1000 with WIN TCP compilation

4. Newbie - CGI Errors when sending HTML Mail

5. $x %= 1000 always 295?

6. Perl for HP 1000

7. Newbie - CGI Errors when sending HTML Mail

8. 1000 thread limit?

9. Sending error messages via e-mail

10. Announce: Apache::Roaming-0.1000

11. Great Employment Opportunities- NY/NJ Fortune 1000 Companies

12. 1000 times slower?

 

 
Powered by phpBB® Forum Software