sg552
July 27th, 2008, 05:21
Hello everyone, can anyone take a look at this script, it's not sending any email.... :(
<?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 = "localhost";
// -----------------------------------------
// The Web Help .com
// -----------------------------------------
// 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" .
$mail->Send()
$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/temp/?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, I get this error.
Parse error: syntax error, unexpected T_STRING in /home/kilot/public_html/mydomain/temp/mailer.php on line 53
This script use some spam filter (regex??) and captchas.
Please help me and thanks in advance :P
<?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 = "localhost";
// -----------------------------------------
// The Web Help .com
// -----------------------------------------
// 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" .
$mail->Send()
$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/temp/?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, I get this error.
Parse error: syntax error, unexpected T_STRING in /home/kilot/public_html/mydomain/temp/mailer.php on line 53
This script use some spam filter (regex??) and captchas.
Please help me and thanks in advance :P