Jump to content

form mail script not working :S


Boxerman

Recommended Posts

Hello everyone, can anyone take a look at this script, it's not sending any email....

 

php Code:

 

<?php

//Bring in the PHPMailer class
require("class.phpmailer.php");

//Create a new mail object.  You'll get an error here is the right files are not required
    //at the top of this script.
    $mail = new phpmailer();
    // set mailer to use SMTP
    $mail->IsSMTP();                                     
    //Specify the use of the local server.
    //Should not have to authenticate.
    //If you get an error sending, use the Christian-Web-Masters.com forums to ask
    //How to change this script to use another server.
    //Or read the documentation for PHPMailer.
    $mail->Host = "smtp.mydomain.com"; 

// -----------------------------------------
//  The Web Help .com
// -----------------------------------------
// remember to replace [email protected] with your own email address lower in this code.

// load the variables form address bar
$to = $_REQUEST["to"];
$to = preg_replace("/[^a-zA-Z0-9@._-]/", "", $to);

$to = explode(",",$to);
$to = $to['0'];




// remove the backslashes that normally appears when entering " or '
$to = stripslashes($to);
$message = stripslashes($message);
$subject = stripslashes($subject);
$sendname = stripslashes($sendname); 
$from = stripslashes($from);

// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
    // if verification code was correct send the message and show this page
   
    $mail->From = $_POST['from'];
    $mail->FromName = $_POST['sendname'];
    $mail->AddAddress = $_POST['to'];
    $mail->Subject = $_POST['subject'] . $subject;
    $mail->Body = $_POST['message'] . "\r\n" . $_POST['message']
                    . "\n\n" . $defaultMessageClose;
   
   
    // delete the cookie so it cannot sent again by refreshing this page
    setcookie('tntcon','');
} else {
    // if verification code was incorrect then return to contact page and show error
    header("Location:http://www.mydomain.com/?wrong_code=true");
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>E-Mail Sent</title>
<style type="text/css">
<!--
body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
}
-->
</style></head>

<body>
Email sent. Thank you.<br />
<br />
Return to <a href="/">home page</a> ?
</body>
</html>

 

This script use SMTP and after I input all the detail and click send, somehow this line executed Email sent. Thank you. but i'm not receiving any email in my inbox... This script use some spam filter (regex??) and captchas.

 

Please help me and thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/116771-form-mail-script-not-working-s/
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.