Boxerman Posted July 26, 2008 Share Posted July 26, 2008 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 you@email.com 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 Quote Link to comment Share on other sites More sharing options...
toivo Posted July 27, 2008 Share Posted July 27, 2008 If you look at the examples from the phpmailer folders you downloaded, you will notice that you need to call the Send function: if(!$mail->Send()) { echo "Mailer Error: " . $mail->ErrorInfo; } else { echo "Message sent!"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.