mail() returns false but mail is sent

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

    mail() returns false but mail is sent

    I'm doing a bit of work for a guy and on his system the mail() function
    always returns false, but the mail is sent.

    Anyone come across this? Any ideas what is causing it and how to fix
    it?
    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/
  • Dave Kelly

    #2
    Re: mail() returns false but mail is sent

    Geoff Berrow wrote:[color=blue]
    > I'm doing a bit of work for a guy and on his system the mail() function
    > always returns false, but the mail is sent.
    >
    > Anyone come across this? Any ideas what is causing it and how to fix
    > it?[/color]
    Sounds like there is a not missing. Got some code to show?

    Comment

    • Geoff Berrow

      #3
      Re: mail() returns false but mail is sent

      Message-ID: <fD%wf.1315$Hd4 .723@newsread1. news.pas.earthl ink.net> from
      Dave Kelly contained the following:
      [color=blue]
      >Geoff Berrow wrote:[color=green]
      >> I'm doing a bit of work for a guy and on his system the mail() function
      >> always returns false, but the mail is sent.
      >>
      >> Anyone come across this? Any ideas what is causing it and how to fix
      >> it?[/color]
      >Sounds like there is a not missing. Got some code to show?[/color]

      Don't think so. My test script is very basic.

      <?php
      // The message
      $message = "Line 1\nLine 2\nLine 3";
      // Send
      if(mail('bl@*** **.co.uk', 'My Subject', $message, 'From:
      <bl@*****.co.uk >')){
      echo "mail sent";
      }

      else{
      echo "mail not sent";
      }
      ?>

      Mail is sent but the screen says mail not sent. Tested on another
      server and it works just fine.
      --
      Geoff Berrow (put thecat out to email)
      It's only Usenet, no one dies.
      My opinions, not the committee's, mine.
      Simple RFDs http://www.ckdog.co.uk/rfdmaker/

      Comment

      • windandwaves

        #4
        Re: mail() returns false but mail is sent

        Geoff Berrow wrote:[color=blue]
        > Message-ID: <fD%wf.1315$Hd4 .723@newsread1. news.pas.earthl ink.net> from
        > Dave Kelly contained the following:
        >[color=green]
        >> Geoff Berrow wrote:[color=darkred]
        >>> I'm doing a bit of work for a guy and on his system the mail()
        >>> function always returns false, but the mail is sent.
        >>>
        >>> Anyone come across this? Any ideas what is causing it and how to
        >>> fix it?[/color]
        >> Sounds like there is a not missing. Got some code to show?[/color]
        >
        > Don't think so. My test script is very basic.
        >
        > <?php
        > // The message
        > $message = "Line 1\nLine 2\nLine 3";
        > // Send
        > if(mail('bl@*** **.co.uk', 'My Subject', $message, 'From:
        > <bl@*****.co.uk >')){
        > echo "mail sent";
        > }
        >
        > else{
        > echo "mail not sent";
        > }[color=green]
        >>[/color]
        >
        > Mail is sent but the screen says mail not sent. Tested on another
        > server and it works just fine.[/color]

        is the problem server a windows server? Mail is handled slightly different
        on a windows server.


        Comment

        • Pedro Graca

          #5
          Re: mail() returns false but mail is sent

          Geoff Berrow wrote:[color=blue]
          > My test script is very basic.
          >
          > <?php
          > // The message
          > $message = "Line 1\nLine 2\nLine 3";
          > // Send
          > if(mail('bl@*** **.co.uk', 'My Subject', $message, 'From:
          > <bl@*****.co.uk >')){
          > echo "mail sent";
          > }
          >
          > else{
          > echo "mail not sent";
          > }
          > ?>
          >
          > Mail is sent but the screen says mail not sent. Tested on another
          > server and it works just fine.[/color]

          What operating system is the script running on?

          What are the mail configuration settings?

          Don't copy them from php.ini; run this script instead:
          <?php
          $opts = array('SMTP', 'smtp_port', 'sendmail_from' , 'sendmail_path' );
          foreach ($opts as $opt) {
          echo $opt, ': [', ini_get($opt), "]<br/>\n";
          }
          ?>

          --
          Mail to my "From:" address is readable by all at http://www.dodgeit.com/
          == ** ## !! ------------------------------------------------ !! ## ** ==
          TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
          may bypass my spam filter. If it does, I may reply from another address!

          Comment

          • Geoff Berrow

            #6
            Re: mail() returns false but mail is sent

            Message-ID: <slrndsb0i5.gck .hexkid@ID-203069.user.ind ividual.net> from
            Pedro Graca contained the following:
            [color=blue]
            >What operating system is the script running on?[/color]

            Linux.[color=blue]
            >
            >What are the mail configuration settings?
            >
            > Don't copy them from php.ini; run this script instead:
            ><?php
            >$opts = array('SMTP', 'smtp_port', 'sendmail_from' , 'sendmail_path' );
            >foreach ($opts as $opt) {
            > echo $opt, ': [', ini_get($opt), "]<br/>\n";
            >}
            >?>[/color]
            Here's what I get:

            SMTP: [localhost]
            smtp_port: [25]
            sendmail_from: []
            sendmail_path: [/usr/sbin/sendmail -t -i]

            --
            Geoff Berrow (put thecat out to email)
            It's only Usenet, no one dies.
            My opinions, not the committee's, mine.
            Simple RFDs http://www.ckdog.co.uk/rfdmaker/

            Comment

            • Pedro Graca

              #7
              Re: mail() returns false but mail is sent

              Geoff Berrow wrote:[color=blue]
              > Message-ID: <slrndsb0i5.gck .hexkid@ID-203069.user.ind ividual.net> from
              > Pedro Graca contained the following:
              >[color=green]
              >>What are the mail configuration settings?[/color]
              >
              > sendmail_path: [/usr/sbin/sendmail -t -i][/color]

              Whoooooaa! diving into OT ... :)

              Can you have a look at the sendmail logs?
              (probably /var/log/mail.err, /var/log/mail.info, and /var/log/mail.log)


              What happens if you do

              /usr/sbin/sendmail -t -i < mailfile

              where mailfile is, for example

              ---- cut ----
              From: "some name" <change_this@se rver.invalid>
              To: "Geoff Berrow" <cat.is.out@exa mple.com>
              Subject: test

              test mail
              ---- cut ----
              --
              Mail to my "From:" address is readable by all at http://www.dodgeit.com/
              == ** ## !! ------------------------------------------------ !! ## ** ==
              TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
              may bypass my spam filter. If it does, I may reply from another address!

              Comment

              Working...