mail and displaying errors

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

    mail and displaying errors

    I'm trying to debug someone else's third party code that I'm trying to
    install on my site. It works for him on his site, but not for me on
    "my" site.

    I've traced the problem to the mail() call. For whatever reason, it's
    failing. And, my question is - how do I make php print the real
    reason for the failure?

    I've modified his code (multiple times), so that it now looks like
    this:

    error_reporting (E_ALL);

    $mail_sent = @mail($Email_Ad dress, $subscribe_emai l_subject,
    $subscribe_conf irm_msg, "From: $DB_OwnerName < $DB_ReplyToEmai l >", "-
    f $DB_ReplyToEmai l");
    if ($mail_sent)
    echo "Mail sent";
    else
    die ("Mail failed" . " in File: " . __FILE__ . " on line: " .
    __LINE__ . " Error was:" . $mail_sent[1] );

    It tells me the mail failed and in what file and on what line as
    expected, but I can't figure out how to make it print the true &
    actual error (such as "permission denied" or perhaps "no such file" or
    whatever the true error is). Prior to my changes, it simply had the
    mail function without the @ and without capturing the return value.

    So my question is two-fold:
    1) How do I print the actual error and
    2) What should I be looking at to figure out why mail is failing to
    send? Or to put it another way, what might be the possible reasons
    mail is failing that I should be checking?

    I'm on a Linux server, but I think he uses Windows to test his code,
    though I'm not sure. I'm somewhat new to PHP, but am very computer
    and programming literate in C. My goal is not to learn PHP, but just
    to get this third party app. working on my web host.

    Thank you

  • Jerry Stuckle

    #2
    Re: mail and displaying errors

    Dudely wrote:
    I'm trying to debug someone else's third party code that I'm trying to
    install on my site. It works for him on his site, but not for me on
    "my" site.
    >
    I've traced the problem to the mail() call. For whatever reason, it's
    failing. And, my question is - how do I make php print the real
    reason for the failure?
    >
    I've modified his code (multiple times), so that it now looks like
    this:
    >
    error_reporting (E_ALL);
    >
    $mail_sent = @mail($Email_Ad dress, $subscribe_emai l_subject,
    $subscribe_conf irm_msg, "From: $DB_OwnerName < $DB_ReplyToEmai l >", "-
    f $DB_ReplyToEmai l");
    if ($mail_sent)
    echo "Mail sent";
    else
    die ("Mail failed" . " in File: " . __FILE__ . " on line: " .
    __LINE__ . " Error was:" . $mail_sent[1] );
    >
    It tells me the mail failed and in what file and on what line as
    expected, but I can't figure out how to make it print the true &
    actual error (such as "permission denied" or perhaps "no such file" or
    whatever the true error is). Prior to my changes, it simply had the
    mail function without the @ and without capturing the return value.
    >
    So my question is two-fold:
    1) How do I print the actual error and
    2) What should I be looking at to figure out why mail is failing to
    send? Or to put it another way, what might be the possible reasons
    mail is failing that I should be checking?
    >
    I'm on a Linux server, but I think he uses Windows to test his code,
    though I'm not sure. I'm somewhat new to PHP, but am very computer
    and programming literate in C. My goal is not to learn PHP, but just
    to get this third party app. working on my web host.
    >
    Thank you
    >
    Do you have an SMTP server (i.e. sendmail) active on your machine, and
    is your php.ini pointing at the executable?


    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Dudely

      #3
      Re: mail and displaying errors

      On May 4, 3:41 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      Dudely wrote:
      I'm trying to debug someone else's third party code that I'm trying to
      install on my site. It works for him on his site, but not for me on
      "my" site.
      >
      I've traced the problem to the mail() call. For whatever reason, it's
      failing. And, my question is - how do I make php print the real
      reason for the failure?
      >
      I've modified his code (multiple times), so that it now looks like
      this:
      >
      error_reporting (E_ALL);
      >
      $mail_sent = @mail($Email_Ad dress, $subscribe_emai l_subject,
      $subscribe_conf irm_msg, "From: $DB_OwnerName < $DB_ReplyToEmai l >", "-
      f $DB_ReplyToEmai l");
      if ($mail_sent)
      echo "Mail sent";
      else
      die ("Mail failed" . " in File: " . __FILE__ . " on line: " .
      __LINE__ . " Error was:" . $mail_sent[1] );
      >
      It tells me the mail failed and in what file and on what line as
      expected, but I can't figure out how to make it print the true &
      actual error (such as "permission denied" or perhaps "no such file" or
      whatever the true error is). Prior to my changes, it simply had the
      mail function without the @ and without capturing the return value.
      >
      So my question is two-fold:
      1) How do I print the actual error and
      2) What should I be looking at to figure out why mail is failing to
      send? Or to put it another way, what might be the possible reasons
      mail is failing that I should be checking?
      >
      I'm on a Linux server, but I think he uses Windows to test his code,
      though I'm not sure. I'm somewhat new to PHP, but am very computer
      and programming literate in C. My goal is not to learn PHP, but just
      to get this third party app. working on my web host.
      >
      Thank you
      >
      Do you have an SMTP server (i.e. sendmail) active on your machine, and
      is your php.ini pointing at the executable?
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===- Hide quoted text -
      >
      - Show quoted text -
      Does the php.ini file affect all users, or is it set on a per user
      basis? If the former, I don't have access. If the latter, should it
      live in my home directory or somewhere else? What does/should it look
      like (where can I get a sample to plop in)? I don't know if sendmail
      runs all the time, but I do have access to the executable. I'm a user
      with typical limited access on a web host that is hosting my web page.

      Thank you

      Comment

      • Jerry Stuckle

        #4
        Re: mail and displaying errors

        Dudely wrote:
        On May 4, 3:41 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        >Dudely wrote:
        >>I'm trying to debug someone else's third party code that I'm trying to
        >>install on my site. It works for him on his site, but not for me on
        >>"my" site.
        >>I've traced the problem to the mail() call. For whatever reason, it's
        >>failing. And, my question is - how do I make php print the real
        >>reason for the failure?
        >>I've modified his code (multiple times), so that it now looks like
        >>this:
        >>error_reporti ng(E_ALL);
        >> $mail_sent = @mail($Email_Ad dress, $subscribe_emai l_subject,
        >>$subscribe_co nfirm_msg, "From: $DB_OwnerName < $DB_ReplyToEmai l >", "-
        >>f $DB_ReplyToEmai l");
        >> if ($mail_sent)
        >> echo "Mail sent";
        >> else
        >> die ("Mail failed" . " in File: " . __FILE__ . " on line: " .
        >>__LINE__ . " Error was:" . $mail_sent[1] );
        >>It tells me the mail failed and in what file and on what line as
        >>expected, but I can't figure out how to make it print the true &
        >>actual error (such as "permission denied" or perhaps "no such file" or
        >>whatever the true error is). Prior to my changes, it simply had the
        >>mail function without the @ and without capturing the return value.
        >>So my question is two-fold:
        >>1) How do I print the actual error and
        >>2) What should I be looking at to figure out why mail is failing to
        >>send? Or to put it another way, what might be the possible reasons
        >>mail is failing that I should be checking?
        >>I'm on a Linux server, but I think he uses Windows to test his code,
        >>though I'm not sure. I'm somewhat new to PHP, but am very computer
        >>and programming literate in C. My goal is not to learn PHP, but just
        >>to get this third party app. working on my web host.
        >>Thank you
        >Do you have an SMTP server (i.e. sendmail) active on your machine, and
        >is your php.ini pointing at the executable?
        >>
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstuck...@attg lobal.net
        >============== ====- Hide quoted text -
        >>
        >- Show quoted text -
        >
        Does the php.ini file affect all users, or is it set on a per user
        basis? If the former, I don't have access. If the latter, should it
        live in my home directory or somewhere else? What does/should it look
        like (where can I get a sample to plop in)? I don't know if sendmail
        runs all the time, but I do have access to the executable. I'm a user
        with typical limited access on a web host that is hosting my web page.
        >
        Thank you
        >
        It affects all users. If you're on a hosted system, you need to contact
        your hosting company. They may not have an SMTP server set up on this
        box, they may restrict it's use to non-web apps, they might require a
        login - or any of a dozen other things.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        Working...