luannj Posted July 3, 2008 Share Posted July 3, 2008 Can Anyone Help?? Our organization recently moved our in-house email service to gmail. My php mail forms tanked after that transition. Nothing I've done to date has worked to restore our form service. I'm a noob with PHP, but I did get our forms working initially a year ago, so I did something right at that time. I was using Tectite's canned form mailer and they worked flawlessly. To try and bring my forms back online, I began cut\pasting simple PHP email scripts. All this work (and time) only resulted in a variety of errors. Would someone be willing to take a look at my scripts and see if you can spot any errors that I'm not seeing? I'd be grateful as nothing I seem to be doing is working working for me. I've spent hours researching and I'm not sure where to go next. The mail.php script: <?php /* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */ $email = "[email protected]"; $name = $HTTP_POST_VARS['name']; $subject = $HTTP_POST_VARS['subject']; $message = $HTTP_POST_VARS['message']; /* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */ if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) { echo "<h4>Invalid email address</h4>"; echo "<a href='javascript:history.back(1);'>Back</a>"; } elseif ($subject == "") { echo "<h4>No subject</h4>"; echo "<a href='javascript:history.back(1);'>Back</a>"; } /* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */ elseif (mail($email,$subject,$message)) { echo "<h4>Thank you for sending email</h4>"; } else { echo "<h4>Can't send email to $email</h4>"; } ?> The mail form using the php script url: http://library2.westliberty.edu/mail.html The error when I click 'Send': http://library2.westliberty.edu/phperror.bmp I'll be happy to post my php.ini if necessary. I really need help. I've worked many hours and my wheels are spinning in no real direction. Lu Ann Link to comment https://forums.phpfreaks.com/topic/113124-simple-email-php-script-help/ Share on other sites More sharing options...
teynon Posted July 3, 2008 Share Posted July 3, 2008 It would appear that your server doesn't have PHP working anymore. The server isn't recognizing the .php extension and therefore assumes it is a downloadable file. Try running a test file like this: <?php echo "helloword.php"; ?> call it test.php, upload it, and try to open it. Link to comment https://forums.phpfreaks.com/topic/113124-simple-email-php-script-help/#findComment-581134 Share on other sites More sharing options...
luannj Posted July 3, 2008 Author Share Posted July 3, 2008 The results of my test.php are in the URL below ... and thanks. http://library2.westliberty.edu/test.php I do see helloworld ... and I can read the phpinfo test page as well. Lu Ann Link to comment https://forums.phpfreaks.com/topic/113124-simple-email-php-script-help/#findComment-581155 Share on other sites More sharing options...
teynon Posted July 3, 2008 Share Posted July 3, 2008 Sorry, I looked at your picture which showed it downloading the file... I would say this problem is simple. You are using some cheap ass freeware application on your server. Hence the error message: Warning: mail() [function.mail]: SMTP server response: 555 This freeware lets you send not more than 10 messages a day in C:\Inetpub\wwwroot\mail.php on line 19 There is nothing wrong with PHP. Link to comment https://forums.phpfreaks.com/topic/113124-simple-email-php-script-help/#findComment-581160 Share on other sites More sharing options...
luannj Posted July 4, 2008 Author Share Posted July 4, 2008 I'm not familiar with the 555 error. I haven't seen it before. The only two errors I've seen is the one I've posted here, and one other that tells me that x.php file cannot be found on the server when I submit the form. The only software that I'm running is the OS, PHP, mail.php, and the mail.html file. I also have an index.html file located in wwwroot. I've tried several cut/paste scripts to resolve my problem; but when they failed, I deleted all the files associated with them. The mail.php code is posted, you can view the mail.html file code from the browser, and I'd be happy to post my php.ini file. Give me some examples of software that would produce the 555 error, and I can double check for them. Again, many thanks. Lu Ann Link to comment https://forums.phpfreaks.com/topic/113124-simple-email-php-script-help/#findComment-581411 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.