mail() problems, how do I print out what the error is?

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default mail() problems, how do I print out what the error is?

    Hello,

    I am having problems with the mail() function, but I don't know what the
    problems are.

    Here is a snippet of code:

    $to = "jmluongo@comcast.net";
    $from = "Gallery@gafok.com";
    $subject = "Gallery Comment";
    $msg = "You have received a comment from " . $commenter_name;
    $msg .= "\n\nAt index: " . $index;
    $msg .= "\n\nIP address: " . $IPNumber;
    $msg .= "\n\nComment: " . stripslashes($comment_text);
    mail($to, $subject, $msg, "$from") or print "Cannot send mail \n";

    I keep getting the "Cannot send mail" message and I want to see why. Is
    there any way to see what the error really is?

    thanks,

    _James Luongo

    James M. Luongo Guest

  2. Similar Questions and Discussions

    1. Print Multiple Mail App Emails as One PDF
      I'm pretty late to the topic but am having the same issue like Keith. Using the latest Mail.app i need to compile roughly 1900 emails that are...
    2. e-Mail Problems
      A .pdf document was created using InDesign CS. When the .pdf document was e-mailed to two individuals one was able to open and print the document but...
    3. Postscript Print error (ERROR: rangecheck; OFFENDING COMMAND: filter)
      We are attempting to print off some rather large image files on a Xerox 340 and an HP Laserjet 4MV printer via Adobe Acrobat 6. Smaller similar files...
    4. PHP Mail Problems
      BillyJoe wrote: I believe the From: needs a real existing email adress.
    5. Problems with mail()
      Im having a formatting issue with mail(). My simple script looks like: $key = blah@blah.com; $subject = "My membership"; $message_to_send =...
  3. #2

    Default Re: mail() problems, how do I print out what the error is?

    Check the [Mail Function] section of your php.ini file and make sure the
    path to your mail server is correct.

    Hamilton

    [url]www.laughland.biz[/url]
    "the web site for web sites"

    "James M. Luongo" <jmluongo@nospam.comcast.net> wrote in message
    news:3F0CAF93.4080506@nospam.comcast.net...
    > You are correct about the From: field, but that didn't solve the
    > problem. It's still not sending the mail and I wish to find out what
    > the error code or message is.
    >
    > -James
    >
    > Joshua Ghiloni wrote:
    >
    > > James M. Luongo wrote:
    > >
    > >> Hello,
    > >>
    > >> I am having problems with the mail() function, but I don't know what
    > >> the problems are.
    > >>
    > >> Here is a snippet of code:
    > >>
    > >> $to = "jmluongo@comcast.net";
    > >> $from = "Gallery@gafok.com";
    > >> $subject = "Gallery Comment";
    > >> $msg = "You have received a comment from " . $commenter_name;
    > >> $msg .= "\n\nAt index: " . $index;
    > >> $msg .= "\n\nIP address: " . $IPNumber;
    > >> $msg .= "\n\nComment: " . stripslashes($comment_text);
    > >> mail($to, $subject, $msg, "$from") or print "Cannot send mail \n";
    > >>
    > >> I keep getting the "Cannot send mail" message and I want to see why.
    > >> Is there any way to see what the error really is?
    > >>
    > >> thanks,
    > >>
    > >> _James Luongo
    > >>
    > > Your From: header is wrong. Read up on the RFC or omit it. I do believe
    > > that your From header should look like (untested)
    > >
    > > $from = "From: [email]Gallery@gafok.com[/email]\r\n";
    > >
    >

    Spidah Guest

  4. #3

    Default Re: mail() problems, how do I print out what the error is?

    "James M. Luongo" <jmluongo@nospam.comcast.net> wrote:
    > I am having problems with the mail() function, but I don't know what the
    > problems are.
    >
    > Here is a snippet of code:
    >
    > $to = "jmluongo@comcast.net";
    > $from = "Gallery@gafok.com";
    > $subject = "Gallery Comment";
    > $msg = "You have received a comment from " . $commenter_name;
    > $msg .= "\n\nAt index: " . $index;
    > $msg .= "\n\nIP address: " . $IPNumber;
    > $msg .= "\n\nComment: " . stripslashes($comment_text);
    > mail($to, $subject, $msg, "$from") or print "Cannot send mail \n";
    Hi James,

    The correct From header would be (and don't forget \r\n):

    $from = "From: [email]Gallery@gafok.com[/email]\r\n";
    // ..
    mail($to, $subject, $msg, $from) or print "Cannot send mail \n";

    If you are on Linux/Unix, check the path to sendmail in php.ini - on
    Windows make sure you've set the SMTP server entry in php.ini to a valid
    SMTP server.

    HTH;
    JOn

    Jon Kraft Guest

  5. #4

    Default Re: mail() problems, how do I print out what the error is?

    I'd recommend checking php.ini to see if php is writing an error log file.
    If it is, check in the error log, there may be more information on the
    problem in there.

    "James M. Luongo" <jmluongo@nospam.comcast.net> wrote in message
    news:3F0C9C3B.60404@nospam.comcast.net...
    > Hello,
    >
    > I am having problems with the mail() function, but I don't know what the
    > problems are.
    >
    > Here is a snippet of code:
    >
    > $to = "jmluongo@comcast.net";
    > $from = "Gallery@gafok.com";
    > $subject = "Gallery Comment";
    > $msg = "You have received a comment from " . $commenter_name;
    > $msg .= "\n\nAt index: " . $index;
    > $msg .= "\n\nIP address: " . $IPNumber;
    > $msg .= "\n\nComment: " . stripslashes($comment_text);
    > mail($to, $subject, $msg, "$from") or print "Cannot send mail \n";
    >
    > I keep getting the "Cannot send mail" message and I want to see why. Is
    > there any way to see what the error really is?
    >
    > thanks,
    >
    > _James Luongo
    >

    Richard Hockey Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139