mail not working

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

    mail not working

    Hi,

    for some reason it seems PHP is not properly passing the sender's
    address to sendmail. It does not matter whether I add "From" as header,
    "nobody@new " is always taken as originating addres (be it return-path,
    from or sender).

    sendmail logs the following line

    SMTP error from remote mailer after MAIL FROM:<nobody@ne w>

    Is this due to a wrong sendmail configuration or would I need to change
    something within PHP?

    Thanks,
    Alexander
  • Daz

    #2
    Re: mail not working


    Alexander wrote:
    Hi,
    >
    for some reason it seems PHP is not properly passing the sender's
    address to sendmail. It does not matter whether I add "From" as header,
    "nobody@new " is always taken as originating addres (be it return-path,
    from or sender).
    >
    sendmail logs the following line
    >
    SMTP error from remote mailer after MAIL FROM:<nobody@ne w>
    >
    Is this due to a wrong sendmail configuration or would I need to change
    something within PHP?
    >
    Thanks,
    Alexander
    Hi Alexander,

    Just a thought, but have you had a look at what comes after the 'MAIL
    FROM' argument. I think this might be where you error lies.

    Daz.

    Comment

    • Geoff Muldoon

      #3
      Re: mail not working

      postmaster@127. 0.0.1 says...
      for some reason it seems PHP is not properly passing the sender's
      address to sendmail. It does not matter whether I add "From" as header,
      "nobody@new " is always taken as originating addres (be it return-path,
      from or sender).
      >
      sendmail logs the following line
      >
      SMTP error from remote mailer after MAIL FROM:<nobody@ne w>
      >
      Is this due to a wrong sendmail configuration or would I need to change
      something within PHP?
      Try:

      $to = "me@testaddress .com";
      $subject = "this is a test";
      $body = "test 123";
      $headers = "From: me@sendaddress. com";
      $params = "-f me@sendaddress. com";

      mail($to, $subject, $body, $headers, $params);

      Notice the fifth parameter with the -f setting. This is used in many
      sendmail installations to set a "canonical" from address, setting it
      purely in the headers is often ignored as it can be used as a common
      spam/spoof exploit.

      Geoff

      Comment

      • Alexander

        #4
        Re: mail not working

        Daz wrote:
        >
        Hi Alexander,
        >
        Just a thought, but have you had a look at what comes after the 'MAIL
        FROM' argument. I think this might be where you error lies.
        >
        Daz.
        >
        Thanks Daz, I was aware that the problem was the wrong return path, but
        I wondered why it was set that way and where the new as hostname came from.

        I solved it meanwhile by overriding the default sendmail_path value with
        a properly added "-f" parameter (php_value did not work for some reason,
        I had to use php_admin_value ) and adding the Apache users to the trusted
        mail users.

        If you want to see it, the site is at http://www.citypics.org/index.php
        - I know, shameless plug ;)

        Thanks again,
        Alexander

        Comment

        • Alexander

          #5
          Re: mail not working

          Geoff Muldoon wrote:
          >
          Try:
          >
          $to = "me@testaddress .com";
          $subject = "this is a test";
          $body = "test 123";
          $headers = "From: me@sendaddress. com";
          $params = "-f me@sendaddress. com";
          >
          mail($to, $subject, $body, $headers, $params);
          >
          Notice the fifth parameter with the -f setting. This is used in many
          sendmail installations to set a "canonical" from address, setting it
          purely in the headers is often ignored as it can be used as a common
          spam/spoof exploit.
          >
          Geoff
          >
          Thank you Geoff!

          As I already wrote in my reply to Daz I solved it meanwhile by doing
          exactly this - more or less :). In order not having to edit any script
          with a mail() call I overrode the host's wide value and it seems to be
          working now.

          Thanks again Geoff,
          Alexander

          Comment

          Working...