Strange php mail problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike the Canadian

    Strange php mail problem

    I am having a very strange problem sending email with php. I have two
    domains. I can send an email to one domain using php but not the
    other. If I put both email addresses in the mail command only the one
    email will arrive. I can send emails the traditional way to the
    problem domain and they arrive fine. Is there anything that might
    explain this?

    _______
    Free Windows Clipboard Utility
    CyberMatrix Clipboard Magic is simple clipboard extender software program.

  • Andy Hassall

    #2
    Re: Strange php mail problem

    On Tue, 26 Jul 2005 19:57:23 GMT, Mike the Canadian
    <inforequest@sp am-killer-remove-techie.com> wrote:
    [color=blue]
    >I am having a very strange problem sending email with php. I have two
    >domains. I can send an email to one domain using php but not the
    >other. If I put both email addresses in the mail command only the one
    >email will arrive. I can send emails the traditional way to the
    >problem domain and they arrive fine. Is there anything that might
    >explain this?[/color]

    Yes, but it'd only be a guess without more information, since there's lots of
    things that could explain it (bugs in your code, misconfigured mail servers,
    correctly configured mailservers rejecting the mail because of how you've sent
    it, etc.)

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    • Mike the Canadian

      #3
      Re: Strange php mail problem

      Andy Hassall <andy@andyh.co. uk> wrote:
      [color=blue]
      >On Tue, 26 Jul 2005 19:57:23 GMT, Mike the Canadian
      ><inforequest@s pam-killer-remove-techie.com> wrote:
      >[color=green]
      >>I am having a very strange problem sending email with php. I have two
      >>domains. I can send an email to one domain using php but not the
      >>other. If I put both email addresses in the mail command only the one
      >>email will arrive. I can send emails the traditional way to the
      >>problem domain and they arrive fine. Is there anything that might
      >>explain this?[/color]
      >
      > Yes, but it'd only be a guess without more information, since there's lots of
      >things that could explain it (bugs in your code, misconfigured mail servers,
      >correctly configured mailservers rejecting the mail because of how you've sent
      >it, etc.)[/color]

      How can it be bugs in my code when it works for one address but not
      the other? How can it be a misconfigured mail server when sending
      email the traditional way works just fine? Why would one server reject
      the mail because of how I sent it when the other will not reject it?

      See below as to how I am sending the email:

      @mail( "$myrow[1]", "password request","You had requested your
      password to be sent to you. You can find your password
      below.\n\nPassw ord: $myrow[0]", "From: Mail Admin <admin@acme.co> ");

      Yes $myrow[0] and $myrow[1] are fine, I checked.

      _______
      Free Windows Clipboard Utility
      CyberMatrix Clipboard Magic is simple clipboard extender software program.

      Comment

      • Geoff Muldoon

        #4
        Re: Strange php mail problem

        inforequest@spa m-killer-remove-techie.com says...
        [color=blue]
        > How can it be bugs in my code when it works for one address but not
        > the other? How can it be a misconfigured mail server when sending
        > email the traditional way works just fine? Why would one server reject
        > the mail because of how I sent it when the other will not reject it?
        >
        > See below as to how I am sending the email:
        >
        > @mail( "$myrow[1]", "password request","You had requested your
        > password to be sent to you. You can find your password
        > below.\n\nPassw ord: $myrow[0]", "From: Mail Admin <admin@acme.co> ");[/color]

        Some mail servers will reject mail where an attempt to set a value for the
        "from" address in the header (as you have done) is in conflict with the
        message's canonical from address (likely to be apache@yourserv er).

        Try it using the optional fifth parameter in PHP's mail function:
        $param='-fadmin@acme.co' ; // the -f at the front of the address is needed
        mail($to, $subject, $body, $headers, $param);
        and see if that fixes it.

        Geoff M

        Comment

        • Gordon Burditt

          #5
          Re: Strange php mail problem

          >How can it be bugs in my code when it works for one address but not[color=blue]
          >the other? How can it be a misconfigured mail server when sending
          >email the traditional way works just fine? Why would one server reject
          >the mail because of how I sent it when the other will not reject it?[/color]

          If your From: line doesn't indicate a mailbox you can ACTUALLY SEND
          MAIL (specifically, a bounce message) TO, some servers will reject
          it. Some mail servers, but not others, may have your web server
          on their spam block list. If the mail contains the line: To:
          <Undisclosed Recipients:;> some mail servers will reject it. If
          your From: address isn't on the right whitelist, some mail servers
          will reject it. In the Age of Spam, it's a wonder you can send
          email at all.

          Gordon L. Burditt

          Comment

          • Mike the Canadian

            #6
            Re: Strange php mail problem

            Geoff Muldoon <geoff.muldoon@ trap.gmail.com> wrote:
            [color=blue]
            >inforequest@sp am-killer-remove-techie.com says...
            >[color=green]
            >> How can it be bugs in my code when it works for one address but not
            >> the other? How can it be a misconfigured mail server when sending
            >> email the traditional way works just fine? Why would one server reject
            >> the mail because of how I sent it when the other will not reject it?
            >>
            >> See below as to how I am sending the email:
            >>
            >> @mail( "$myrow[1]", "password request","You had requested your
            >> password to be sent to you. You can find your password
            >> below.\n\nPassw ord: $myrow[0]", "From: Mail Admin <admin@acme.co> ");[/color]
            >
            >Some mail servers will reject mail where an attempt to set a value for the
            >"from" address in the header (as you have done) is in conflict with the
            >message's canonical from address (likely to be apache@yourserv er).
            >
            >Try it using the optional fifth parameter in PHP's mail function:
            >$param='-fadmin@acme.co' ; // the -f at the front of the address is needed
            >mail($to, $subject, $body, $headers, $param);
            >and see if that fixes it.[/color]

            Weird, using -f I now get an "Unrouteabl e address" bounce.

            _______
            Free Windows Clipboard Utility
            CyberMatrix Clipboard Magic is simple clipboard extender software program.

            Comment

            • Geoff Muldoon

              #7
              Re: Strange php mail problem

              inforequest@spa m-killer-remove-techie.com says...
              [color=blue][color=green]
              > >Some mail servers will reject mail where an attempt to set a value for the
              > >"from" address in the header (as you have done) is in conflict with the
              > >message's canonical from address (likely to be apache@yourserv er).
              > >
              > >Try it using the optional fifth parameter in PHP's mail function:
              > >$param='-fadmin@acme.co' ; // the -f at the front of the address is needed
              > >mail($to, $subject, $body, $headers, $param);
              > >and see if that fixes it.[/color]
              >
              > Weird, using -f I now get an "Unrouteabl e address" bounce.[/color]

              On the target address that used to fail using your initial method, or
              both?

              One of the upsides to using the -f param method is that bounces are likely
              to be returned to the nominated -f address whereas using your initial
              method they may well have just gone to the apache account. If mail to
              that apache account wasn't been set to /dev/null see if your initial
              method was always bouncing mail to that address as well. If so, I suspect
              it's a host/DNS problem between your PHP server and that target server.

              Geoff M

              Comment

              Working...