problems with MIME:Lite timeout

Discussion in 'Perl Misc' started by dan baker, Aug 30, 2004.

  1. dan baker

    dan baker Guest

    I am trying to build a simple little script using MIME:Lite to run
    through about 200 email addresses and send a simple text message. I
    seem to be having a problem with a timeout as it gets though 5 or ten
    addresses and then quits with the message:
    Failed to connect to mail server: Bad file descriptor

    I have tried sending a 'hello' every time, but that doesn't seem to
    change the behavior....

    I am running perl from ActiveState precompiled for windows98 on a PC,
    and attempting to send via SMTP thru my server. I am wondering if
    there is any way to disconnect and reconnect every 5 addresses or
    something like that?

    here is a snippet, with some error checking removed for brevity:

    foreach $Recipient ( @tempList ) {

    $First_Name = '';
    $Last_Name = '';
    $email = '';
    $MarriedName = '';

    # split the raw CSV textline
    if ( $Recipient =~ m/"(.*)","(.*)","(.*)","(.*)"/ ) {
    $First_Name = $1 ;
    $Last_Name = $2 ;
    $email = $3 ;
    $MarriedName = $4 ;
    }

    $Recipient = "$First_Name $Last_Name";
    if ( $MarriedName ) { $Recipient .= "-$MarriedName" }
    $Recipient = "\"$Recipient\"\<$email\>";

    # handshake server again
    MIME::Lite->send('smtp', $cSMTPserver ,
    Hello=>$cSMTPserver , Timeout=>60 );

    # send mail
    # -----
    $msg='';
    $msg = MIME::Lite->new(
    From => $Sender ,
    To => $Recipient ,
    Subject => $Subject ,
    Type => $Type ,
    Data => $Body
    );

    unless ( $msg->send() ) { # send it now
    print "...send FAILED \n\n";
    }
    }
    dan baker, Aug 30, 2004
    #1
    1. Advertising

  2. dan baker wrote:
    > I am trying to build a simple little script using MIME:Lite to run
    > through about 200 email addresses and send a simple text message. I
    > seem to be having a problem with a timeout as it gets though 5 or
    > ten addresses and then quits with the message:


    > Failed to connect to mail server: Bad file descriptor


    Sounds like a server configuration thing to me.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Aug 30, 2004
    #2
    1. Advertising

  3. dan baker

    dan baker Guest

    Gunnar Hjalmarsson <> wrote in message news:<>...
    >
    > > Failed to connect to mail server: Bad file descriptor

    > Sounds like a server configuration thing to me.

    ---------------

    that is what I suspect... I use Comcast cable for my ISP, and
    apparently they have some "throttling" going on to attempt to control
    outgoing mail in case people get a virus, or try to spam the world.

    I am not is a huge hurry to send out my couple hundred newsletters, so
    I am hoping that there is some way for me to use MIME:Lite to send a
    couple, disconnect, reconnect, and send a couple more... I just want
    to automate it so I dont have to manually chop the list up .

    so..... any tips on how to send a couple emails (using SMTP), then
    pause or timeout, or whatever, and re-establish a connection and send
    a coulpe more? I have tried a couple things using different values for
    the timeout, combined with sleep() inbetween and it does not seem to
    have any effect.
    MIME::Lite->send('smtp', $cSMTPserver , Hello=>$cSMTPserver ,
    Timeout=>10 );


    d
    dan baker, Aug 31, 2004
    #3
  4. <CC to you - posted to group>

    dan baker wrote:
    > I am trying to build a simple little script using MIME:Lite to run
    > through about 200 email addresses and send a simple text message. I
    > seem to be having a problem with a timeout as it gets though 5 or ten
    > addresses and then quits with the message:
    > Failed to connect to mail server: Bad file descriptor


    In replay to what you wrote about dealing with the timeout issue ...
    ...snip..

    > here is a snippet, with some error checking removed for brevity:
    >
    > foreach $Recipient ( @tempList ) {


    sleep 10; #or whatever value seems good for you

    Since you need the script to not "ponud the living <insert explitive
    here>" out of the server and counting/chomping/splitting/etc. doesn't
    seem practical, this may be the best solution.

    HTH

    Jim
    James Willmore, Aug 31, 2004
    #4
  5. dan baker wrote:
    > Gunnar Hjalmarsson wrote:
    >> dan baker wrote:
    >>> Failed to connect to mail server: Bad file descriptor

    >>
    >> Sounds like a server configuration thing to me.

    >
    > that is what I suspect... I use Comcast cable for my ISP, and
    > apparently they have some "throttling" going on to attempt to
    > control outgoing mail in case people get a virus, or try to spam
    > the world.


    Unfortunately, Comcast's customers are not just *trying* to spam the
    world. One of the Comcast connected spammers is sending from a vast
    number of open relay servers, forging "From:" addresses using my
    domain name, and as a result my mail server receives 5-10 bounces per
    minute - day after day, week after week... I have frantically tried
    to call Comcast's attention to it, but not even a human reply. :(

    Maybe your problem indicates that they are at least doing something
    with respect to their own mail servers.

    > I am not is a huge hurry to send out my couple hundred newsletters,
    > so I am hoping that there is some way for me to use MIME:Lite to
    > send a couple, disconnect, reconnect, and send a couple more... I
    > just want to automate it so I dont have to manually chop the list
    > up .


    To be perfectly honest, and don't misunderstand me, personally I hope
    that your problem is not too easily solved. ;-)

    Some ISP's grant temporary permission to send bulk emails for a
    specific reason. Don't know about Comcast, but maybe it would be worth
    asking.

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Aug 31, 2004
    #5
  6. dan baker

    dan baker Guest

    (dan baker) wrote in message news:<>...
    > I am trying to build a simple little script using MIME:Lite to run
    > through about 200 email addresses and send a simple text message. I
    > seem to be having a problem with a timeout as it gets though 5 or ten
    > addresses and then quits with the message:
    > -------------------


    well, I have a little more info from comcast, but not much. turns out
    that the first tier support thinks that the default send rate is about
    10 or 15 per minute... above which the anti-spam trigger blacklists
    the account and you get whacked for a minimum of 48 hours.

    so, as soon as i am live again, I may try a sleep(5) for each address
    in the loop, which seems reasonable as it would be unacceptably slow
    for most spammers. Anyway, I am still interested to know if there is a
    way to disconnect/reconnect, or if this is some kinda timeout thing,
    or what. I don't know much about how the smtp connection stuff works.

    d
    dan baker, Sep 1, 2004
    #6
  7. dan baker

    dan baker Guest

    (dan baker) wrote in message news:<>...
    > I am trying to build a simple little script using MIME:Lite to run
    > through about 200 email addresses and send a simple text message. I
    > seem to be having a problem with a timeout as it gets though 5 or ten
    > addresses and then quits with the message:
    > Failed to connect to mail server: Bad file descriptor
    > -----------------------------



    I just wanted to post the working solution in case somebody looks
    later....

    Turns out that with the metering done by Comcast (my ISP), you can
    only send a max of 20 messages per minute, and a max of 1000 per day.
    Not really unlimited email now, is it?! Anyway, it turns out that to
    get the script to chew through my little list I did NOT need to send a
    Hello first, and in fact the connection gets dropped after about 30
    seconds regardless.

    So.... the way to do it is to forget the hello up front, and specify
    the smtp server with each send, and sleep(4) between each address.
    Inside the loop:

    foreach $Recipient (@RList){

    $msg = '';
    $msg = MIME::Lite->new(
    From => $Sender ,
    To => $Recipient ,
    Subject => $Subject ,
    Type => $Type ,
    Data => $Body
    );
    $msg->send('smtp', $cSMTPserver) ;
    sleep(4);
    }
    dan baker, Sep 2, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John B. Kim

    MIME::Lite HTML message handling

    John B. Kim, Jan 18, 2004, in forum: Perl
    Replies:
    1
    Views:
    1,703
    Joe Smith
    Jan 19, 2004
  2. Zev Steinhardt

    Perl Mime::Lite question. Help please?

    Zev Steinhardt, Aug 24, 2004, in forum: Perl
    Replies:
    1
    Views:
    749
    dan baker
    Sep 1, 2004
  3. Aaron Brady

    SQL, lite lite lite

    Aaron Brady, Dec 29, 2008, in forum: Python
    Replies:
    15
    Views:
    749
    Aaron Brady
    Jan 1, 2009
  4. Jane Humbrey
    Replies:
    5
    Views:
    271
    Jane Humbrey
    Sep 1, 2003
  5. john.swilting

    problems mime::lite

    john.swilting, Feb 12, 2007, in forum: Perl Misc
    Replies:
    1
    Views:
    105
    Tad McClellan
    Feb 12, 2007
Loading...

Share This Page