Jump to content

Form Mailer Problem


CheeseMan42

Recommended Posts

i have a php form mailer for a site that i made and it doesnt seem to be sending. where do i specify where i want it sent?

<?

//>----------------------------------------------------------------------------<
//>  PHP Mailer                    Version 1.0                                 <
//>  Copyright 2002 Ray Jones      [email protected]                               <
//>----------------------------------------------------------------------------<
//>  COPYRIGHT NOTICE                                                          <
//>  Copyright 2002 Ray Jones  All Rights Reserved.                            <
//>                                                                            <
//>  PHP Mailer may be used and modified free of charge by anyone so long      <
//>  as this copyright notice and the comments above remain intact.  By using  <
//>  this code you agree to indemnify Ray Jones from any liability that might  <
//>  arise from it's use                                                       <
//>----------------------------------------------------------------------------<
//>  CONFIGURE THIS SCRIPT                                                     <
//>  To configure this script you will need to:                                <
//>  Modify the variables in the block - $to through $fieldten so they map to  <
//>  your preferred form field names.                                          <
//>  Modify $denyall to 1 if you want to block remote calls to this script, 0  <
//>         if you do not.                                                     <
//>  Modify $siteurl if deny all is set to 1.                                  <
//>  Modify $autoresponse if to 1 if you want to send autoresponse, 0 if you do<
//>         not.                                                               <
//>  Modify $index to point to the customised ad index file you want to use.   <
//>  Modify $confsubject and $automessage to suit your needs if autoresponse is<
//>         set to 1.                                                          <
//>  Modify any or all of the message files referred to in the script to suit  <
//>         your site.  These are bademail.html, outside.html, blankfields.html<
//>         thankyou.html and autothankyou.html                                <
//>  FORM ACTION                                                               <
//>  Don't forget to change the URL in your form's action field so it points to<
//>  this file                                                                 <
//>----------------------------------------------------------------------------<
//> Set up the scripts variables                                               <
//>----------------------------------------------------------------------------<

$to = $to;
$from = $from;
$email = $email;
$subject = $phone;
$message = $comments;
$today = date ("l, F jS Y");

//>----------------------------------------------------------------------------<
//> Script options                                                             <
//>----------------------------------------------------------------------------<

$denyall = "0";
$siteurl = "www.cars.com";
$callingurl = getenv("HTTP_REFERER");

$autoresponse = "0";
$confsubject = "Confirmation of email sent from widget web site";
$automessage = "This email is to confirm the following message : ";

//>----------------------------------------------------------------------------<
//> Check that the script is being accessed from within it's own site          <
//>----------------------------------------------------------------------------<

if ($denyall == "1") {
       $siteurllen = strlen($siteurl);
       $striphttp = ereg_replace ("http://", "", $callingurl);
       $urltochk = substr($striphttp, 0, $siteurllen);
       if ($siteurl != $urltochk) {
               readfile("outside.html");
               exit;
       } else {
       }
}

//>----------------------------------------------------------------------------<
//> Check that all fields have been completed                                  <
//>----------------------------------------------------------------------------<

if (($to == "") || ($from == "") || ($email == "") || ($subject == "") || ($message == "")) {
       readfile("blankfields.html");
       exit;
       } else {
       }

//>----------------------------------------------------------------------------<
//> Check that e-mail address adhere to the minimum format requirements        <
//>----------------------------------------------------------------------------<

if (($email != "")) {
       $locationofat = strpos($email, '@');
       $locationofdot = strrpos($email, '.');
       if (($locationofat == "0") || ($locationofdot < $locationofat) || $locationofdot == "0") {
               readfile("bademail.html");
               exit;
               } else {
               }
}

//>----------------------------------------------------------------------------<
//> Everything checks out ok so send the email                                 <
//>----------------------------------------------------------------------------<
//> First compile the message body.                                            <
//> You can arrange these lines in any order you like.                         <
//>----------------------------------------------------------------------------<
$msg = "Message\n\n";
$msg .= " $message\n";
$msg .= "Sent : $today\n";

//>----------------------------------------------------------------------------<
//> Now send the mail                                                          <
//>----------------------------------------------------------------------------<

$mailheaders = "From: Web Design tools ( $from )<> \n";
$mailheaders .= "Reply-To: $email\n\n";

mail($to, $subject, $msg, $mailheaders);

//>----------------------------------------------------------------------------<
//> Prepare autoresponse if necessary                                          <
//>----------------------------------------------------------------------------<

if ($autoresponse == "1") {
       $to1 = $email;
       $email = $to;
       $to = $to1;

       $subject = $confsubject;

       $msg = " $automessage\n\n";
       $msg = "Message Sent\n\n";
       $msg .= " $message\n";
     
       $msg .= "Sent : $today\n";

       $mailheaders = "From: Web Design tools ( $email )<> \n";
       $mailheaders .= "Reply-To: $email\n\n";

       mail($to, $subject, $msg, $mailheaders);

       readfile("autothankyou.html");

       } else {
       readfile("thanks.htm");
       }

exit;

thanks for any help

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...