Re: [PHP] What if this code is right ? It worked perfectly for years!!
> $fName = $_REQUEST['fName'] ; > $emailid = $_REQUEST['emailid'] ; > $number = $_REQUEST['number'] ; > $message = $_REQUEST['message'] ; > > mail( "ch...@gmail.com", $number, $message, "From: $emailid" ); > header( "Location: http://www.thankyou.com/thankYouContact.php"; ); > ?> This is a bit of a hang-up of mine so forgive me if it's mildly OT, but if you do figure out what the problem is, and fix it, you may want to revisit this code in a more extensive way, if what you've pasted above is exactly the code you use in your live application. Please ignore if you've simplified the code above for simplicity's sake. At any rate the code above is most likely vulnerable to SMTP injection, because it passes the unfiltered value of '$emailid' as part of the 'additional_headers' argument to mail(). So the form could be used to send spam to arbitrary email addresses. I'd recommend using filter_input(), with the FILTER_VALIDATE_EMAIL filter, to get at the 'emailid' parameter: http://us3.php.net/manual/en/function.filter-input.php Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
2009/8/24 Paul M Foster : > On Mon, Aug 24, 2009 at 10:37:11AM -0700, Chris Carter wrote: > >> >> Is there any alternative method to do this !!! Sending email through PHP? >> > > Sure. You can use a class like PHPMailer rather than the built-in mail() > function. But it's not going to matter if the problem is at the mail > server, etc. > > Paul Agreed. Rather than just trying things willy-nilly, the OP should attempt to determine what the actual problem is. This gives a much greater chance of solving it. Torben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
On Mon, Aug 24, 2009 at 10:37:11AM -0700, Chris Carter wrote: > > Is there any alternative method to do this !!! Sending email through PHP? > Sure. You can use a class like PHPMailer rather than the built-in mail() function. But it's not going to matter if the problem is at the mail server, etc. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
Is there any alternative method to do this !!! Sending email through PHP? Paul M Foster wrote: > > On Mon, Aug 24, 2009 at 09:12:19AM -0700, Chris Carter wrote: > >> >> Hi, >> >> The code below actually takes input from a web form and sends the fields >> captured in an email. It used to work quite well since past few years. It >> has stopped now. I used Google's mail servers (google.com/a/website.com) >> >> > $fName = $_REQUEST['fName'] ; >> $emailid = $_REQUEST['emailid'] ; >> $number = $_REQUEST['number'] ; >> $message = $_REQUEST['message'] ; >> >> mail( "ch...@gmail.com", $number, $message, "From: $emailid" ); >> header( "Location: http://www.thankyou.com/thankYouContact.php"; ); >> ?> >> >> This is the simplest one, how could it simply stop? Any help would be >> appreciated, I have already lost 148 queries that came through this form. > > As a test, change $_REQUEST above to $_POST (assuming POST method on the > form), and try it. > > Also check the return value of the mail() function to see if it thinks > it has succeeded or failed. If it fails, check the mail logs on the > server to find what the mail server thinks is wrong. > > Paul > > -- > Paul M. Foster > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- View this message in context: http://www.nabble.com/What-if-this-code-is-right---It-worked-perfectly-for-years%21%21-tp25118874p25120282.html Sent from the PHP - General mailing list archive at Nabble.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
On Mon, 2009-08-24 at 12:26 -0400, Paul M Foster wrote: > On Mon, Aug 24, 2009 at 09:12:19AM -0700, Chris Carter wrote: > > > > > Hi, > > > > The code below actually takes input from a web form and sends the fields > > captured in an email. It used to work quite well since past few years. It > > has stopped now. I used Google's mail servers (google.com/a/website.com) > > > > > $fName = $_REQUEST['fName'] ; > > $emailid = $_REQUEST['emailid'] ; > > $number = $_REQUEST['number'] ; > > $message = $_REQUEST['message'] ; > > > > mail( "ch...@gmail.com", $number, $message, "From: $emailid" ); > > header( "Location: http://www.thankyou.com/thankYouContact.php"; ); > > ?> > > > > This is the simplest one, how could it simply stop? Any help would be > > appreciated, I have already lost 148 queries that came through this form. > > As a test, change $_REQUEST above to $_POST (assuming POST method on the > form), and try it. > > Also check the return value of the mail() function to see if it thinks > it has succeeded or failed. If it fails, check the mail logs on the > server to find what the mail server thinks is wrong. > > Paul > > -- > Paul M. Foster > The $_REQUEST will not have anything to do with it. $_REQUEST contains any values sent by POST. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] What if this code is right ? It worked perfectly for years!!
You are absolutely right, more information is needed. Many ISP's are changing port number assignments on their SMTP outgoing email to prevent abuse. A simple change like that could cause the email to not go out, and it has nothing to do with PHP. Warren Vail Vail Systems Technology -Original Message- From: Lars Torben Wilson [mailto:larstor...@gmail.com] Sent: Monday, August 24, 2009 9:21 AM To: Chris Carter Cc: php-general@lists.php.net Subject: Re: [PHP] What if this code is right ? It worked perfectly for years!! 2009/8/24 Chris Carter : > > Hi, > > The code below actually takes input from a web form and sends the fields > captured in an email. It used to work quite well since past few years. It > has stopped now. I used Google's mail servers (google.com/a/website.com) > > $fName = $_REQUEST['fName'] ; > $emailid = $_REQUEST['emailid'] ; > $number = $_REQUEST['number'] ; > $message = $_REQUEST['message'] ; > > mail( "ch...@gmail.com", $number, $message, "From: $emailid" ); > header( "Location: http://www.thankyou.com/thankYouContact.php"; ); > ?> > > This is the simplest one, how could it simply stop? Any help would be > appreciated, I have already lost 148 queries that came through this form. > > Thanks in advance, > > Chris Hi Chris, More information would be very helpful. In exactly what way is it failing? Blank page? Apparently normal operation, except the email isn't being sent? Error messages? Log messages? etc. . . One possibility is that the server config has changed to no longer allow short open tags. This is easy to check for by simply replacing 'http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
On Mon, Aug 24, 2009 at 09:12:19AM -0700, Chris Carter wrote: > > Hi, > > The code below actually takes input from a web form and sends the fields > captured in an email. It used to work quite well since past few years. It > has stopped now. I used Google's mail servers (google.com/a/website.com) > >$fName = $_REQUEST['fName'] ; > $emailid = $_REQUEST['emailid'] ; > $number = $_REQUEST['number'] ; > $message = $_REQUEST['message'] ; > > mail( "ch...@gmail.com", $number, $message, "From: $emailid" ); > header( "Location: http://www.thankyou.com/thankYouContact.php"; ); > ?> > > This is the simplest one, how could it simply stop? Any help would be > appreciated, I have already lost 148 queries that came through this form. As a test, change $_REQUEST above to $_POST (assuming POST method on the form), and try it. Also check the return value of the mail() function to see if it thinks it has succeeded or failed. If it fails, check the mail logs on the server to find what the mail server thinks is wrong. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
2009/8/24 Chris Carter : > > Hi, > > The code below actually takes input from a web form and sends the fields > captured in an email. It used to work quite well since past few years. It > has stopped now. I used Google's mail servers (google.com/a/website.com) > > $fName = $_REQUEST['fName'] ; > $emailid = $_REQUEST['emailid'] ; > $number = $_REQUEST['number'] ; > $message = $_REQUEST['message'] ; > > mail( "ch...@gmail.com", $number, $message, "From: $emailid" ); > header( "Location: http://www.thankyou.com/thankYouContact.php"; ); > ?> > > This is the simplest one, how could it simply stop? Any help would be > appreciated, I have already lost 148 queries that came through this form. > > Thanks in advance, > > Chris Hi Chris, More information would be very helpful. In exactly what way is it failing? Blank page? Apparently normal operation, except the email isn't being sent? Error messages? Log messages? etc. . . One possibility is that the server config has changed to no longer allow short open tags. This is easy to check for by simply replacing 'http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What if this code is right ? It worked perfectly for years!!
On Mon, 2009-08-24 at 09:12 -0700, Chris Carter wrote: > Hi, > > The code below actually takes input from a web form and sends the fields > captured in an email. It used to work quite well since past few years. It > has stopped now. I used Google's mail servers (google.com/a/website.com) > >$fName = $_REQUEST['fName'] ; > $emailid = $_REQUEST['emailid'] ; > $number = $_REQUEST['number'] ; > $message = $_REQUEST['message'] ; > > mail( "ch...@gmail.com", $number, $message, "From: $emailid" ); > header( "Location: http://www.thankyou.com/thankYouContact.php"; ); > ?> > > This is the simplest one, how could it simply stop? Any help would be > appreciated, I have already lost 148 queries that came through this form. > > Thanks in advance, > > Chris > > -- > View this message in context: > http://www.nabble.com/What-if-this-code-is-right---It-worked-perfectly-for-years%21%21-tp25118874p25118874.html > Sent from the PHP - General mailing list archive at Nabble.com. > > Have you tried it without the header redirect in there? There might be some sort of error message that you are never seeing because of that. Also, do you know for definite that the mail() function has stopped working? It could be that you are just not receiving the emails anymore due to some over zealous spam filter. Try sending the email to a variety of email accounts and see what happens. Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php