[thelist] Perl: when to close sendmail

Manish Sharma msharma at satyam.net.in
Thu Aug 16 06:06:48 CDT 2001


Tony, This might be a trifle late but here goes...
I open sendmail only once. Send the email through a for loop and close it. I
guess it amounts to lesser server resources.(?)
Manish

Regards
Manish Sharma
http://www.simplygraphix.com - Extreme web design
http://www.fontmagic.com - Largest True Type Fonts archive on the Internet
http://www.webdevelopersnotes.com - Tutorials, tips, tricks, graphics,
resources and much more
----- Original Message -----
From: Chuck Sumpter <frodo_tx at yahoo.com>
To: <thelist at lists.evolt.org>
Sent: Tuesday, August 14, 2001 2:41 AM
Subject: Re: [thelist] Perl: when to close sendmail


> -- Tony Grimes <algrimes at acs.ucalgary.ca> wrote:
> > Hi,
> >      I'm writing a Perl script that will email multiple email
> > subscriptions to Smartlist using sendmail. I'm planning on putting the
> > sendmail code in a subroutine, but I'm wondering if I should open/close
> > sendmail from within the subroutine. For example, here is what the code
> > might look like (I haven't actually written the script yet):
> ============> code went here, trimmed to please list overlord
> > Will there be any problems if I open and close sendmail each time a
> > message is sent? Does it increase chances of a sendmail crash, or put
> > too much stress on the server? Is there a better way to do this? Any
help
> > would be much appreciated.
>
> Tony,
>
> Here is a snipet of code that I had in a perl script to send e-mails out
to
> users asking for some action on their part.   I was processing an extract
from
> a DB and deciding who to send emails' to.  I never did an open/close, just
> populated some vars with the "stuff" to send and then did this within the
while
> loop that ground through the file...
>
> <CODE>
> %mail = ( To  => $user_addr,
>     From => $admin_addr,
>   Subject => $subject,
>     Message => "@msg_to_user"
> );
>
>         sendmail(%mail) or die $Mail::Sendmail::error;
>
> ++$email_sent;
> </CODE>
>
>
> I generated 5k plus messages with no problems....however it is a big
server on
> an intranet.  Maybe someone else has a better idea.  That's the good thing
> about Perl, 1000 ways to do most things :)
>
> HTH,
>
> Chuck
>
> oops, almost forgot "use Mail::Sendmail;" up front...  :\
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list