mail() function always works fine, but hangs.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • martin

    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. ("defaulttimeou t"
    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_p ath" 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
  • Manuel Lemos

    #2
    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. ("defaulttimeou t"
    > 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_p ath" 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


    Comment

    • martin

      #3
      Re: mail() function always works fine, but hangs.

      Manuel Lemos <mlemos@acm.org > wrote in message news:<buhfvm$i2 2nk$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. ("defaulttimeou t"
      > > 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_p ath" 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

      Comment

      • Manuel Lemos

        #4
        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. ("defaulttimeou t"
        >>>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_p ath" 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().



        You will also need this:




        --

        Regards,
        Manuel Lemos

        Free ready to use OOP components written in PHP


        Comment

        Working...