Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 03:35 AM
martin
Guest
 
Posts: n/a
Default mail() function always works fine, but hangs.

Just the simplest invocation with hard coded parameters, followed
by echoing a message, hangs for exactly 1 minute. ("defaulttimeout"
in php.ini is set to 30 (seconds)). If I don't wait, and immediately
hit the browser's "stop" button I get that "transfer interrupted"
message, but the email still gets sent and received just fine.
Sendmail is not running, "sendmail_path" is not set in php.ini, and
the email headers look as if the email was sent from the command line
using /bin/mail. Any thoughts on making mail() not hang, please?

Thanks,
Martin



  #2  
Old July 17th, 2005, 03:35 AM
Manuel Lemos
Guest
 
Posts: n/a
Default Re: mail() function always works fine, but hangs.

Hello,

On 01/19/2004 06:45 PM, martin wrote:[color=blue]
> Just the simplest invocation with hard coded parameters, followed
> by echoing a message, hangs for exactly 1 minute. ("defaulttimeout"
> in php.ini is set to 30 (seconds)). If I don't wait, and immediately
> hit the browser's "stop" button I get that "transfer interrupted"
> message, but the email still gets sent and received just fine.
> Sendmail is not running, "sendmail_path" is not set in php.ini, and
> the email headers look as if the email was sent from the command line
> using /bin/mail. Any thoughts on making mail() not hang, please?[/color]

This looks like you are trying to send messages from a server without a
DNS reverse record (PTR). If you do not know what that means, just let
me know the address of the server and I can check that for you.

--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

  #3  
Old July 17th, 2005, 03:36 AM
martin
Guest
 
Posts: n/a
Default Re: mail() function always works fine, but hangs.

Manuel Lemos <mlemos@acm.org> wrote in message news:<buhfvm$i22nk$1@ID-138275.news.uni-berlin.de>...[color=blue]
> Hello,
>
> On 01/19/2004 06:45 PM, martin wrote:[color=green]
> > Just the simplest invocation with hard coded parameters, followed
> > by echoing a message, hangs for exactly 1 minute. ("defaulttimeout"
> > in php.ini is set to 30 (seconds)). If I don't wait, and immediately
> > hit the browser's "stop" button I get that "transfer interrupted"
> > message, but the email still gets sent and received just fine.
> > Sendmail is not running, "sendmail_path" is not set in php.ini, and
> > the email headers look as if the email was sent from the command line
> > using /bin/mail. Any thoughts on making mail() not hang, please?[/color]
>
> This looks like you are trying to send messages from a server without a
> DNS reverse record (PTR). If you do not know what that means, just let
> me know the address of the server and I can check that for you.[/color]

That's correct, it's just my home machine which I use for development.
I added the test code to the file on the real server and it does not
hang. Is there a work-around for my home server? I read "out there"
some references to having the /etc/hosts entry correct. It's setup to
check /etc/hosts first. What's DNS got to do with it? The To: and From:
in mail() are both set to my earthlink.net address. I have two references
to my machine in /etc/hosts: "127.0.0.1 localhost loghost" and "<my IP
address> <my hostname>". There is no domain specified as there it has no
domain name. Does this relate? (Keep in mind that the emails go out OK.)

Thanks a lot,
Martin
  #4  
Old July 17th, 2005, 03:36 AM
Manuel Lemos
Guest
 
Posts: n/a
Default Re: mail() function always works fine, but hangs.

Hello,

On 01/20/2004 12:45 AM, martin wrote:[color=blue][color=green][color=darkred]
>>>Just the simplest invocation with hard coded parameters, followed
>>>by echoing a message, hangs for exactly 1 minute. ("defaulttimeout"
>>>in php.ini is set to 30 (seconds)). If I don't wait, and immediately
>>>hit the browser's "stop" button I get that "transfer interrupted"
>>>message, but the email still gets sent and received just fine.
>>>Sendmail is not running, "sendmail_path" is not set in php.ini, and
>>>the email headers look as if the email was sent from the command line
>>>using /bin/mail. Any thoughts on making mail() not hang, please?[/color]
>>
>>This looks like you are trying to send messages from a server without a
>>DNS reverse record (PTR). If you do not know what that means, just let
>>me know the address of the server and I can check that for you.[/color]
>
>
> That's correct, it's just my home machine which I use for development.
> I added the test code to the file on the real server and it does not
> hang. Is there a work-around for my home server? I read "out there"
> some references to having the /etc/hosts entry correct. It's setup to
> check /etc/hosts first. What's DNS got to do with it? The To: and From:
> in mail() are both set to my earthlink.net address. I have two references
> to my machine in /etc/hosts: "127.0.0.1 localhost loghost" and "<my IP
> address> <my hostname>". There is no domain specified as there it has no
> domain name. Does this relate? (Keep in mind that the emails go out OK.)[/color]

Hanging often means either that the destination SMTP server is trying to
resolve domain of the origin IP address but it will fail after timeout,
or your ISP router is blocking port 25 (SMTP) outgoing connections to
any other SMTP server than theirs.

Either way the messages are probably hanging in your local MTA message
queue and the solution is to relay in a SMTP server that you have
authorization to relay messages, meaning your ISP.

If you are using Linux/Unix, you can relay in your to whatever SMTP
server your ISP is using by configuring your sendmail (or whatever local
MTA you use) to route the messages. You may also need to configure to
perform authentication which is very likely.

All the above is tricky and if you do not have enough skills you may
want to try this PHP only solution that is basically a mail class that
lets you configure the relay SMTP server and authentication credentials.
All you need to do is to make an include of smtp_mail.php and change
your calls to the mail() function just to smtp_mail().

http://www.phpclasses.org/mimemessage

You will also need this:

http://www.phpclasses.org/smtpclass


--

Regards,
Manuel Lemos

Free ready to use OOP components written in PHP
http://www.phpclasses.org/

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,414 network members.