problems with MIME:Lite timeout

D

dan baker

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";
}
}
 
G

Gunnar Hjalmarsson

dan said:
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.
 
D

dan baker

Gunnar Hjalmarsson said:
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
 
J

James Willmore

<CC to you - posted to group>

dan said:
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
 
G

Gunnar Hjalmarsson

dan said:
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.
 
D

dan baker

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
 
D

dan baker

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);
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top