[PHP] mail () error
Anyone know what causes this error? Warning: mail ()[function.mail]: Failed to receive Can it not find the mail server? On a side note, is there a PHP resource on the net that will listed error messages and their possible causes? Thanks, Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail () error
Thanks, the server was relaying, but it turned out to be the firewall that was rejecting the request. Now I have a new problem thought, my mail () command will send the mail (and I receive it) but it will just hang there and eventually return this: Fatal error: Maximum execution time of 30 seconds exceeded The email goes through, but it won't process any of the code after it. Is it waiting for a response from the mail server? Can I disable that? Steve "John W. Holmes" <[EMAIL PROTECTED]> wrote in message 004901c2be5a$a384f910$7c02a8c0@coconut">news:004901c2be5a$a384f910$7c02a8c0@coconut... > > Anyone know what causes this error? > > > > Warning: mail ()[function.mail]: Failed to receive > > > > Can it not find the mail server? > > When I got this error it was because the server was rejecting the email, > saying it wouldn't relay the message. Maybe check your relay setting in > your SMTP server? > > ---John W. Holmes... > > PHP Architect - A monthly magazine for PHP Professionals. Get your copy > today. http://www.phparch.com/ > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Variable Declare
Hey guys, Thanks in advance for your help. I'm working on emailing the contents of a form using php. It worked fine, until I turned global_variables off in an attempt to secure the form (I still have yet to write the data validation part). Anyway, I have an IF statement that fires depending on a hidden variable in the form. If the variable is empty, it loads the form. If the variable contains the hidden value I give it during form creation, then it emails the contents on the form and displays a thank you msg instead of displaying the form. The problem I have run into, involves the hidden value for the form. I didn't have to declare it before when I had global_variables turned on, but now I have to. I searched the manual and tried statements like "global $variablename" but the code wouldn't run properly. I've searched through the newsgroups as well, but I'm new to PHP so it was tough to figure out what to search for. I'm sure all I'm missing is one line of code. I included my code below. The problem exists in this line: if ($_POST['frmAction'] == "formmail") which is before where the form is created so the $frmAction variable isn't declared yet. I'm getting a variable not declared error, which I know, but if I declare the variable earlier in the document, then it resets the value that I give it before I submit the form. How do I make this work? Thanks so very much!! Steve **HTML stuff here** \n"); fputs($fd, "Subject: $_POST['inforequest']\n"); fputs($fd, "X-Mailer: PHP3\n"); fputs($fd, "Name: $_POST['name']\n"); fputs($fd, "Business: $_POST['business']\n"); fputs($fd, "Phone: $_POST['phone']\n"); fputs($fd, "Email: $_POST['email']\n"); fputs($fd, "Details: $_POST['details']"); pclose($fd); ?> **HTML thank you msg here** Select Info Source Option 1 Option 2 Option 3 Option 4 **last bit of HTML here** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Variable Declare
Thanks!! That worked perfectly. Neat little function there to check if a variable exists. Also I am set to "E_ERROR & ~E_NOTICE" already. The form loads correctly and then when you click submit goes to the thank you screen. The only problem now is that it says that my variables don't exist that I pass using the form and as a result, won't email them. When it gets to the code to email the results the variables like $_POST['name'] won't exist. What puzzles me is that the frmAction is passed, but none of the textbox...etc. variables are. Do I need to add in the form name somewhere to show where the variables are coming from? "Thomas Seifert" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > try: > if (isset($_POST['frmAction']) && $_POST['frmAction'] == "formmail") > > instead of your line. > > > > Thomas > > On Wed, 22 Jan 2003 09:47:46 -0500 [EMAIL PROTECTED] (Stephen Goehler) wrote: > > > Hey guys, > > > > Thanks in advance for your help. > > > > I'm working on emailing the contents of a form using php. It worked fine, > > until I turned global_variables off in an attempt to secure the form (I > > still have yet to write the data validation part). > > > > Anyway, I have an IF statement that fires depending on a hidden variable in > > the form. If the > > variable is empty, it loads the form. If the variable contains the hidden > > value I give it during form creation, then it emails the contents on the > > form and displays a thank you msg instead of displaying the form. > > > > The problem I have run into, involves the hidden value for the form. I > > didn't have to declare it before when I had global_variables turned on, but > > now I have to. I searched the manual and tried statements like "global > > $variablename" but the code wouldn't run properly. I've searched through > > the newsgroups as well, but I'm new to PHP so it was tough to figure out > > what to search for. I'm sure all I'm missing is one line of code. I > > included my code below. The problem exists in this line: > > > > if ($_POST['frmAction'] == "formmail") > > > > which is before where the form is created so the $frmAction variable isn't > > declared yet. I'm > > getting a variable not declared error, which I know, but if I declare the > > variable earlier in the document, then it resets the value that I give it > > before I submit the form. How do I make this work? > > > > Thanks so very much!! > > > > Steve > > > > > > > > > > > > **HTML stuff here** > > > > > // error handler > > function e($type, $msg, $file, $line) > > { > > $errorLog = "error.log"; > > **Error Handler code here** > > } > > > > error_reporting(E_ERROR | E_WARNING); > > set_error_handler("e"); > > > > $TO = "[EMAIL PROTECTED]"; > > $MP = "mail.mailserver.com"; > > ?> > > > > > if ($_POST['frmAction'] == "formmail") > > { > > > > > > $fd = popen($MP,"w"); > > fputs($fd, "To: $TO\n"); > > fputs($fd, "From: $_POST['name'] <$_POST['email']>\n"); > > fputs($fd, "Subject: $_POST['inforequest']\n"); > > fputs($fd, "X-Mailer: PHP3\n"); > > fputs($fd, "Name: $_POST['name']\n"); > > fputs($fd, "Business: $_POST['business']\n"); > > fputs($fd, "Phone: $_POST['phone']\n"); > > fputs($fd, "Email: $_POST['email']\n"); > > fputs($fd, "Details: $_POST['details']"); > > pclose($fd); > > > > ?> > > > > **HTML thank you msg here** > > > > > > > exit; > > } else { > > > > ?> > > > > > > > > Select Info Source > > Option 1 > > Option 2 > > Option 3 > > Option 4 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > rows="8"> > > > > > > > > > > > > > > > > > > > > > > > > > } > > ?> > > > > **last bit of HTML here** > > > > > > > > > > > -- > Thomas Seifert > > mailto:[EMAIL PROTECTED] > http://www.MyPhorum.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Variable Declare
Now it gets more confusing.I added: print ''; print_r($_POST); print ''; to my form and the variables are displayed properly, but only generate errors when I try to add it to fputs().any ideas? "Stephen Goehler" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Thanks!! That worked perfectly. Neat little function there to check if a > variable exists. Also I am set to "E_ERROR & ~E_NOTICE" already. > > The form loads correctly and then when you click submit goes to the thank > you screen. The only problem now is that it says that my variables don't > exist that I pass using the form and as a result, won't email them. When it > gets to the code to email the results the variables like $_POST['name'] > won't exist. What puzzles me is that the frmAction is passed, but none of > the textbox...etc. variables are. Do I need to add in the form name > somewhere to show where the variables are coming from? > > > > "Thomas Seifert" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > try: > > if (isset($_POST['frmAction']) && $_POST['frmAction'] == "formmail") > > > > instead of your line. > > > > > > > > Thomas > > > > On Wed, 22 Jan 2003 09:47:46 -0500 [EMAIL PROTECTED] (Stephen Goehler) > wrote: > > > > > Hey guys, > > > > > > Thanks in advance for your help. > > > > > > I'm working on emailing the contents of a form using php. It worked > fine, > > > until I turned global_variables off in an attempt to secure the form (I > > > still have yet to write the data validation part). > > > > > > Anyway, I have an IF statement that fires depending on a hidden variable > in > > > the form. If the > > > variable is empty, it loads the form. If the variable contains the > hidden > > > value I give it during form creation, then it emails the contents on the > > > form and displays a thank you msg instead of displaying the form. > > > > > > The problem I have run into, involves the hidden value for the form. I > > > didn't have to declare it before when I had global_variables turned on, > but > > > now I have to. I searched the manual and tried statements like "global > > > $variablename" but the code wouldn't run properly. I've searched > through > > > the newsgroups as well, but I'm new to PHP so it was tough to figure out > > > what to search for. I'm sure all I'm missing is one line of code. I > > > included my code below. The problem exists in this line: > > > > > > if ($_POST['frmAction'] == "formmail") > > > > > > which is before where the form is created so the $frmAction variable > isn't > > > declared yet. I'm > > > getting a variable not declared error, which I know, but if I declare > the > > > variable earlier in the document, then it resets the value that I give > it > > > before I submit the form. How do I make this work? > > > > > > Thanks so very much!! > > > > > > Steve > > > > > > > > > > > > > > > > > > **HTML stuff here** > > > > > > > > // error handler > > > function e($type, $msg, $file, $line) > > > { > > > $errorLog = "error.log"; > > > **Error Handler code here** > > > } > > > > > > error_reporting(E_ERROR | E_WARNING); > > > set_error_handler("e"); > > > > > > $TO = "[EMAIL PROTECTED]"; > > > $MP = "mail.mailserver.com"; > > > ?> > > > > > > > > if ($_POST['frmAction'] == "formmail") > > > { > > > > > > > > > $fd = popen($MP,"w"); > > > fputs($fd, "To: $TO\n"); > > > fputs($fd, "From: $_POST['name'] <$_POST['email']>\n"); > > > fputs($fd, "Subject: $_POST['inforequest']\n"); > > > fputs($fd, "X-Mailer: PHP3\n"); > > > fputs($fd, "Name: $_POST['name']\n"); > > > fputs($fd, "Business: $_POST['business']\n"); > > > fputs($fd, "Phone: $_POS
[PHP] Re: PHP Variable Declare
Thanks guys for helping out. I got it working now! "Thomas Seifert" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > it won't work the way you are doing this. > > Try something like that line (changed from yours): > > fputs($fd, "From: ".$_POST['name']." <".$_POST['email'].">\n"); > > Don't ask arrays directly in a string. > > > > > Thomas > > > On Wed, 22 Jan 2003 11:15:35 -0500 [EMAIL PROTECTED] (Stephen Goehler) wrote: > > > Now it gets more confusing.I added: > > > > print ''; > > > > print_r($_POST); > > > > print ''; > > > > to my form and the variables are displayed properly, but only generate > > errors when I try to add it to fputs().any ideas? > > > > > > "Stephen Goehler" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Thanks!! That worked perfectly. Neat little function there to check if a > > > variable exists. Also I am set to "E_ERROR & ~E_NOTICE" already. > > > > > > The form loads correctly and then when you click submit goes to the thank > > > you screen. The only problem now is that it says that my variables don't > > > exist that I pass using the form and as a result, won't email them. When > > it > > > gets to the code to email the results the variables like $_POST['name'] > > > won't exist. What puzzles me is that the frmAction is passed, but none of > > > the textbox...etc. variables are. Do I need to add in the form name > > > somewhere to show where the variables are coming from? > > > > > > > > > > > > "Thomas Seifert" <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > try: > > > > if (isset($_POST['frmAction']) && $_POST['frmAction'] == "formmail") > > > > > > > > instead of your line. > > > > > > > > > > > > > > > > Thomas > > > > > > > > On Wed, 22 Jan 2003 09:47:46 -0500 [EMAIL PROTECTED] (Stephen Goehler) > > > wrote: > > > > > > > > > Hey guys, > > > > > > > > > > Thanks in advance for your help. > > > > > > > > > > I'm working on emailing the contents of a form using php. It worked > > > fine, > > > > > until I turned global_variables off in an attempt to secure the form > > (I > > > > > still have yet to write the data validation part). > > > > > > > > > > Anyway, I have an IF statement that fires depending on a hidden > > variable > > > in > > > > > the form. If the > > > > > variable is empty, it loads the form. If the variable contains the > > > hidden > > > > > value I give it during form creation, then it emails the contents on > > the > > > > > form and displays a thank you msg instead of displaying the form. > > > > > > > > > > The problem I have run into, involves the hidden value for the form. > > I > > > > > didn't have to declare it before when I had global_variables turned > > on, > > > but > > > > > now I have to. I searched the manual and tried statements like > > "global > > > > > $variablename" but the code wouldn't run properly. I've searched > > > through > > > > > the newsgroups as well, but I'm new to PHP so it was tough to figure > > out > > > > > what to search for. I'm sure all I'm missing is one line of code. I > > > > > included my code below. The problem exists in this line: > > > > > > > > > > if ($_POST['frmAction'] == "formmail") > > > > > > > > > > which is before where the form is created so the $frmAction variable > > > isn't > > > > > declared yet. I'm > > > > > getting a variable not declared error, which I know, but if I declare > > > the > > > > > variable earlier in the document, then it resets the value that I give > > > it > > > > > before I submit the form. How do I make this work? > &