Jump to content

problem with email script


mrwhitee

Recommended Posts

This script used to work but I recently noticed it doesnt work anymore. I am not sure if the issue is with the script or my server. I turned on errors in the php.ini to see what it was doing. see below. Also, my php version is 5.3.3 on centos 5.9 and MySQL version 5.0.95

 

 

 

 

Notice: Undefined variable: name in /home/cool/public_html/test/html/config.inc on line 55 Notice: Undefined variable: email in /home/cool/public_html/test/html/config.inc on line 55 Notice: Undefined variable: company in /home/cool/public_html/test/html/config.inc on line 55 Notice: Undefined variable: phone in /home/cool/public_html/test/html/config.inc on line 55 Notice: Undefined variable: website in /home/cool/public_html/test/html/config.inc on line 55 Notice: Undefined variable: msg in /home/cool/public_html/test/html/config.inc on line 55 Notice: Use of undefined constant name - assumed 'name' in /home/cool/public_html/test/html/contact.php on line 25 Notice: Use of undefined constant email - assumed 'email' in /home/cool/public_html/test/html/contact.php on line 26 Notice: Use of undefined constant company - assumed 'company' in /home/cool/public_html/test/html/contact.php on line 27 Notice: Use of undefined constant phone - assumed 'phone' in /home/cool/public_html/test/html/contact.php on line 28 Notice: Use of undefined constant website - assumed 'website' in /home/cool/public_html/test/html/contact.php on line 29 Notice: Use of undefined constant msg - assumed 'msg' in /home/cool/public_html/test/html/contact.php on line 30 Notice: Use of undefined constant subject - assumed 'subject' in /home/cool/public_html/test/html/contact.php on line 31 Notice: Undefined variable: who in /home/cool/public_html/test/html/contact.php on line 34 Notice: Undefined index: in /home/cool/public_html/test/html/contact.php on line 34

Thank you for your inquiry. We will reply ASAP!

 

 

 

Here is my config.inc

 

 

<?
#########################################################
# ContactForm                                           #
#########################################################
#                                                       #
# Created by: Doni Ronquillo                            #
# Modified by: CodeMunkyX                               #
#                                                       #
# This script and all included functions, images,       #
# and documentation are copyright 2003                  #
# free-php.net (http://free-php.net) unless             #
# otherwise stated in the module.                       #
#                                                       #
# Any copying, distribution, modification with          #
# intent to distribute as new code will result          #
# in immediate loss of your rights to use this          #
# program as well as possible legal action.             #
#                                                       #
#########################################################

# script name
$scriptname = "Contact Form";

# use full paths
# not using full paths could prevent the script from functioning properly

# script directory # no trailing slash
$script_dir = "/home/cool/public_html/test/html";

# script url (url to script directory above)
# no trailing slash
$script_url = "http://www.cool.com/test/html";

# variables below corresponds to the Email to * in your contact form
# match the numbers to the value for which option maps to a specific email
# you can add more as long as you keep them in sync

$adminemail[1] = "[email protected]";
$adminemail[2] = "[email protected]";
$adminemail[3] = "[email protected]";

# preceeds the subject the user puts in on the contact form
$subjectheader = "[Contact Form]:";

# url the form will redirect to after sending email
$redirecturl = "";

# text that will display if you leave above variable blank
$finishedtext = "Thank you for your inquiry. We will reply ASAP!";

# how the message will show in the email
# you can reorder these how you wish or modify the message itself to your liking
# just be sure and leave the $variables in tact

$msg2 = "
    Name: $name
    Email: $email
    Company: $company
    Phone: $phone
    Website: $website
    Message:$msg
" ;
?>

 

 

 

 

 

 

 

This is my contact.php

 

 

 

 

 

 

<?
#########################################################
# ContactForm                                           #
#########################################################
#                                                       #
# Created by: Doni Ronquillo                            #
# Modified by: CodeMunkyX                               #
#                                                       #
# This script and all included functions, images,       #
# and documentation are copyright 2003                  #
# free-php.net (http://free-php.net) unless             #
# otherwise stated in the module.                       #
#                                                       #
# Any copying, distribution, modification with          #
# intent to distribute as new code will result          #
# in immediate loss of your rights to use this          #
# program as well as possible legal action.             #
#                                                       #
#########################################################

   include('config.inc');

    if ($_SERVER['REQUEST_METHOD'] == "POST") {

      $name     = $_POST[name];
      $email    = $_POST;
      $company  = $_POST[company];
      $phone    = $_POST[phone];
      $website  = $_POST[website];
      $msg      = $_POST[msg];
      $subject  = $_POST[subject];
      
      // $msg2 is set in config.inc which formats the body of the message
       mail("$adminemail[$who]", "$subjectheader $subject", "$msg2", "From: $email \nReply-To: $email");

      if ($redirecturl != "") {
         header("Location: $redirecturl");
      } else {
         echo "<br><center>$finishedtext</center><br>";
      }

    } else {
      include($script_dir . '/inc/header.php');
       include($script_dir . '/inc/contactform.php');
      include($script_dir . '/inc/footer.php');
    }
?>

 

 

 

 

Also

 

 

 

This is what shows up in mail logs but no mail is sent.  I changed the domain name.

 ns1 sendmail[13739]: r3ALtE1X013739: from=apache, size=206, class=0, nrcpts=0, msgid=<[email protected]>, relay=apache@localhost
Link to comment
https://forums.phpfreaks.com/topic/276793-problem-with-email-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.