Sendmail always timeout.

Im writing a PHP Mailing List Script. Then i loop for the email addresses in the database then email them each using sendmail. It's working but it always timeout. (30 sec) I'm using PHP,Apache,Sendmail for Windows
deepsweechAsked:
Who is Participating?
 
frankcheongConnect With a Mentor Commented:
I have similar exp when sending the mail on local host using sendmail directly, I got no delay.

While when sending using smtp on remote SMTP gateway, it would delay for at least 10 second each email (a rough guess as I don't have timed).

It is actually becoz the local sendmail only put your request on queue and thus can return to your program immediately while when sending using SMTP gateway, it will need to complete the job before closing your connection.
0
 
cagriCommented:
What gets timeout ? You collect addresses, you open a text file or a pipe to sendmail, put those adresses (or one of them) in to To: field (Cc or Bcc), send the e-mail. At this point it normally queues the e-mail. Although the case is not that clear to me, could you please setting the e-mail body in a text file and send this one later ? If there is a problem with the body or header, you will probably notice this looking at the text file.

Do you mind sharing the piece of code sending mails ?

Hope this helps,
0
 
jlevieCommented:
A 30 second timeout on each message could be the result of Sendmail's reverse lookup on the sender IP or Sendmail timing out an ident request. Ident request can, and usually should, be disables by including:

define(`confTO_IDENT', `0')dnl

in the sendmail.mc used to build sendmail.cf. Reverse DNS issues can be solved by making sure that there's a correct PTR record for the sender's IP or by properly defining the sender's IP/hostname in the hosts file of the Sendmail server.
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
anfiCommented:
Which sendmail version do you use ?
http://www.sendmail.org/faq/section4.html#4.16
Q4.16 -- How do I find sendmail's version number?
0
 
deepsweechAuthor Commented:
Thanks to you all here is the problem:
i retrieve email addresses from the database(mySQL) then in my PHP page, I have a Loop where i email each of the email addresses i have. its like:

do {
$to = $row_GetEmail['Email'];
$from =  ...
$header = ....
mail($to, $from, .....)
} while ($row_GetEmail = mysql_fetch_assoc($rsGetEmail));

but my page expires. i tried printing a counter and i saw that it can only send 2 - 5 emails. i even received an email so i know there's no error in the mail() function. I tried researching for solution and I read 1 site saying I must turn on the email queueing of the sendmail config in php.ini. but it's not available for sendmail for windows/apache/php.

Thanks.
0
 
jlevieCommented:
Where is the Sendmail that you are using running,  the windows version of Sendmail on the local machine or some other host?

What happens if you do, on this system, a telnet on port 25 to the Sendmail server you use? Does that show the same 30 second delay?
0
 
HalldorGCommented:
This could be because of the sendmail is failing look up the destination email addresses.
That is to say check that name resolving is working on the server.

If that is not the case and it is resolving fine check the maillog
/var/log/maillog or /var/log/messages while you are sending

Suggest

tail -f /var/log/maillog /var/log/messages

Tweeking the queuing start at load in sendmail.cf  might help as if you see that sendmail is rejecting connections
in the log file
0
 
frankcheongCommented:
I guess it is the standard behavior of modern SMTP (maybe customizable) coz I have setup a postfix as an SMTP server and the same thing applies too.

This have positive effect on delaying during spamming abuse.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.