Mail not working

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nobrow@gmail.com

    #1

    Mail not working

    I cannot get php to send an email. This works:

    $ mail -s "My Subject" nobrow@gmail.co m
    My Message
    ^D
    Cc:
    [enter]

    But this doesnt:

    <?php
    mail('nobrow@gm ail.com', 'My Subject', 'My Message')
    or
    die('shit!');
    ?>

    I don't know where to look for error messages so I have no further
    info. Anyone got a clue?

    P.S.

    Im using ssmtp, and php.ini contains:

    sendmail_path =ssmtp

  • ZeldorBlat

    #2
    Re: Mail not working

    On Jun 14, 12:22 pm, nob...@gmail.co m wrote:
    I cannot get php to send an email. This works:
    >
    $ mail -s "My Subject" nob...@gmail.co m
    My Message
    ^D
    Cc:
    [enter]
    >
    But this doesnt:
    >
    <?php
    mail('nob...@gm ail.com', 'My Subject', 'My Message')
    or
    die('shit!');
    ?>
    >
    I don't know where to look for error messages so I have no further
    info. Anyone got a clue?
    >
    P.S.
    >
    Im using ssmtp, and php.ini contains:
    >
    sendmail_path =ssmtp
    What do you mean by "doesn't work?" As in you never get the mail? As
    in the script dies with "shit?" As in you get an error message?

    Comment

    • nobrow@gmail.com

      #3
      Re: Mail not working

      On Jun 14, 5:55 pm, ZeldorBlat <zeldorb...@gma il.comwrote:
      On Jun 14, 12:22 pm, nob...@gmail.co m wrote:
      >
      >
      >
      I cannot get php to send an email. This works:
      >
      $ mail -s "My Subject" nob...@gmail.co m
      My Message
      ^D
      Cc:
      [enter]
      >
      But this doesnt:
      >
      <?php
      mail('nob...@gm ail.com', 'My Subject', 'My Message')
      or
      die('shit!');
      ?>
      >
      I don't know where to look for error messages so I have no further
      info. Anyone got a clue?
      >
      P.S.
      >
      Im using ssmtp, and php.ini contains:
      >
      sendmail_path =ssmtp
      >
      What do you mean by "doesn't work?" As in you never get the mail? As
      in the script dies with "shit?" As in you get an error message?
      No email, mail function returns false, and the die clause kicks in ...

      Comment

      • ZeldorBlat

        #4
        Re: Mail not working

        On Jun 14, 1:22 pm, nob...@gmail.co m wrote:
        On Jun 14, 5:55 pm, ZeldorBlat <zeldorb...@gma il.comwrote:
        >
        >
        >
        On Jun 14, 12:22 pm, nob...@gmail.co m wrote:
        >
        I cannot get php to send an email. This works:
        >
        $ mail -s "My Subject" nob...@gmail.co m
        My Message
        ^D
        Cc:
        [enter]
        >
        But this doesnt:
        >
        <?php
        mail('nob...@gm ail.com', 'My Subject', 'My Message')
        or
        die('shit!');
        ?>
        >
        I don't know where to look for error messages so I have no further
        info. Anyone got a clue?
        >
        P.S.
        >
        Im using ssmtp, and php.ini contains:
        >
        sendmail_path =ssmtp
        >
        What do you mean by "doesn't work?" As in you never get the mail? As
        in the script dies with "shit?" As in you get an error message?
        >
        No email, mail function returns false, and the die clause kicks in ...
        Turn up error_reporting and enable display_errors in php.ini. That
        will give you any error messages that might be there.

        Comment

        • nobrow@gmail.com

          #5
          Re: Mail not working


          ZeldorBlat wrote:
          On Jun 14, 1:22 pm, nob...@gmail.co m wrote:
          On Jun 14, 5:55 pm, ZeldorBlat <zeldorb...@gma il.comwrote:


          On Jun 14, 12:22 pm, nob...@gmail.co m wrote:
          I cannot get php to send an email. This works:
          $ mail -s "My Subject" nob...@gmail.co m
          My Message
          ^D
          Cc:
          [enter]
          But this doesnt:
          <?php
          mail('nob...@gm ail.com', 'My Subject', 'My Message')
          or
          die('shit!');
          ?>
          I don't know where to look for error messages so I have no further
          info. Anyone got a clue?
          P.S.
          Im using ssmtp, and php.ini contains:
          sendmail_path =ssmtp
          What do you mean by "doesn't work?" As in you never get the mail? As
          in the script dies with "shit?" As in you get an error message?
          No email, mail function returns false, and the die clause kicks in ...
          >
          Turn up error_reporting and enable display_errors in php.ini. That
          will give you any error messages that might be there.
          Sounded like a good idea but the default values were:

          error_reporting = E_ALL & ~E_NOTICE
          display_errors = On

          so I reckon if there are error messages theyd be displayed ... which
          isnt happening.

          Is there a php error/message log?

          Comment

          • Michael Fesser

            #6
            Re: Mail not working

            ..oO(nobrow@gma il.com)
            >Sounded like a good idea but the default values were:
            >
            >error_reportin g = E_ALL & ~E_NOTICE
            On a development machine it should _always_ be

            error_reporting = E_ALL

            or even

            error_reporting = E_ALL | E_STRICT

            Just as a side note, I can't help with your current problem.

            Micha

            Comment

            • nobrow@gmail.com

              #7
              Re: Mail not working

              On Jun 14, 5:22 pm, nob...@gmail.co m wrote:
              I cannot get php to send an email. This works:
              >
              $ mail -s "My Subject" nob...@gmail.co m
              My Message
              ^D
              Cc:
              [enter]
              >
              But this doesnt:
              >
              <?php
              mail('nob...@gm ail.com', 'My Subject', 'My Message')
              or
              die('shit!');
              ?>
              >
              I don't know where to look for error messages so I have no further
              info. Anyone got a clue?
              >
              P.S.
              >
              Im using ssmtp, and php.ini contains:
              >
              sendmail_path =ssmtp
              It works from the interactive php shell, so the conclusion is that
              this is actually an apache problem, perhaps related to running in a
              chroot.

              Comment

              • bill

                #8
                Re: Mail not working

                nobrow@gmail.co m wrote:
                On Jun 14, 5:22 pm, nob...@gmail.co m wrote:
                >I cannot get php to send an email. This works:
                >>
                >$ mail -s "My Subject" nob...@gmail.co m
                >My Message
                >^D
                >Cc:
                >[enter]
                >>
                >But this doesnt:
                >>
                ><?php
                > mail('nob...@gm ail.com', 'My Subject', 'My Message')
                > or
                > die('shit!');
                >?>
                >>
                >I don't know where to look for error messages so I have no further
                >info. Anyone got a clue?
                >>
                >P.S.
                >>
                >Im using ssmtp, and php.ini contains:
                >>
                >sendmail_pat h =ssmtp
                >
                It works from the interactive php shell, so the conclusion is that
                this is actually an apache problem, perhaps related to running in a
                chroot.
                >
                working from the command line is invoking the shell's mail, not
                PHP's mail.

                Comment

                • nobrow@gmail.com

                  #9
                  Re: Mail not working

                  On Jun 15, 7:27 pm, bill <nob...@spamcop .netwrote:
                  nob...@gmail.co m wrote:
                  On Jun 14, 5:22 pm, nob...@gmail.co m wrote:
                  I cannot get php to send an email. This works:
                  >
                  $ mail -s "My Subject" nob...@gmail.co m
                  My Message
                  ^D
                  Cc:
                  [enter]
                  >
                  But this doesnt:
                  >
                  <?php
                  mail('nob...@gm ail.com', 'My Subject', 'My Message')
                  or
                  die('shit!');
                  ?>
                  >
                  I don't know where to look for error messages so I have no further
                  info. Anyone got a clue?
                  >
                  P.S.
                  >
                  Im using ssmtp, and php.ini contains:
                  >
                  sendmail_path =ssmtp
                  >
                  It works from the interactive php shell, so the conclusion is that
                  this is actually an apache problem, perhaps related to running in a
                  chroot.
                  >
                  working from the command line is invoking the shell's mail, not
                  PHP's mail.
                  The problem was that there was no mail program in the chroot I run
                  Apache in. Installed one and got it working and alls fine now. Silly
                  oversight really.

                  Comment

                  • nobrow@gmail.com

                    #10
                    Re: Mail not working

                    On Jun 15, 7:27 pm, bill <nob...@spamcop .netwrote:
                    nob...@gmail.co m wrote:
                    On Jun 14, 5:22 pm, nob...@gmail.co m wrote:
                    I cannot get php to send an email. This works:
                    >
                    $ mail -s "My Subject" nob...@gmail.co m
                    My Message
                    ^D
                    Cc:
                    [enter]
                    >
                    But this doesnt:
                    >
                    <?php
                    mail('nob...@gm ail.com', 'My Subject', 'My Message')
                    or
                    die('shit!');
                    ?>
                    >
                    I don't know where to look for error messages so I have no further
                    info. Anyone got a clue?
                    >
                    P.S.
                    >
                    Im using ssmtp, and php.ini contains:
                    >
                    sendmail_path =ssmtp
                    >
                    It works from the interactive php shell, so the conclusion is that
                    this is actually an apache problem, perhaps related to running in a
                    chroot.
                    >
                    working from the command line is invoking the shell's mail, not
                    PHP's mail.
                    BTW, I was talking about it working in "the interactive php shell" ...
                    $ php -a ...

                    Comment

                    Working...