Hi there, I have an e-card system on my website, which was working fine until my host performed an upgrade from PHP4 to PHP5 a few days ago. Now the recepient does not receive the email telling him/her to view the e-card.The postcard system can be found on: www.tickity-boo.co.uk/site/postcard.php and the script is as follows: <?php require_once ("database.php"); $page = $_SERVER['HTTP_REFERER']; $card = $_POST['postcard']; $stamp = $_POST['stamp']; $sname = $_POST['sname']; $semail = $_POST['semail']; $rname = $_POST['rname']; $remail = $_POST['remail']; $message = $_POST['message']; $database = new TB_Database; $dataLink = $database->DB_databaseConnect(); $query = "INSERT INTO tbPost(post_card , post_stamp, post_sname, post_semail , post_rname, post_remail, post_message, post_date, post_active) VALUES ('$card', '$stamp', '$sname', '$semail', '$rname', '$remail', '$message', now(), '1')"; mysql_query($query,$dataLink); $postid = mysql_query("SELECT MAX(post_id) FROM tbPost"); $post = mysql_fetch_array($postid); if ($page=="http://www.tickity-boo.co.uk/site/postcard04.php") { $subject= $semail." has sent you an e-card"; $header= "From: info@tickity-boo.co.uk\r\n"; $header.= "Content-Type: text/html\r\n\r\n"; $header.= "<html><p>Hi,</p>"; $header.= "<p>You have been sent an e-card from ".$sname."</p>"; $header.= "<p>It can be viewed at <a href=\"http://www.tickity-boo.co.uk/site/postview.php?post=".$post['MAX(post_id)']." \">www.tickity-boo.co.uk/site/postview.php?post=".$post['MAX(post_id)']."</p>"; $header.= "</html>"; mail($remail,$subject,"","MIME=Version:1.0\r\n$header"); } mysql_close($dataLink); ?> Any help would be much appreciated. Many thanks, Aden
Any further to solving it? Also I keep being reffered to http://phpmailer.sourceforge.net/, but all I want is if possible to adapt/correct the existing script
Hi, I replaced the code in the postsend.php file to: <?php require("class.phpmailer.php"); require_once ("../classes/Database.php"); $page = $_SERVER['HTTP_REFERER']; $card = $_POST['postcard']; $stamp = $_POST['stamp']; $sname = $_POST['sname']; $semail = $_POST['semail']; $rname = $_POST['rname']; $remail = $_POST['remail']; $message = $_POST['message']; $database = new TB_Database; $dataLink = $database->DB_databaseConnect(); $query = "INSERT INTO tbPost(post_card , post_stamp, post_sname, post_semail , post_rname, post_remail, post_message, post_date, post_active) VALUES ('$card', '$stamp', '$sname', '$semail', '$rname', '$remail', '$message', now(), '1')"; mysql_query($query,$dataLink); $postid = mysql_query("SELECT MAX(post_id) FROM tbPost"); $post = mysql_fetch_array($postid); if ($page=="http://www.tickity-boo.co.uk/site/postcard04.php") { //$subject= $semail." has sent you an e-card"; //$header= "From: info@tickity-boo.co.uk\r\n"; //$header.= "Content-Type: text/html\r\n\r\n"; //$header.= "<html><p>Hi,</p>"; //$header.= "<p>You have been sent an e-card from ".$sname."</p>"; //$header.= "<p>It can be viewed at <a href=\"http://www.tickity-boo.co.uk/site/postview.php?post=".$post['MAX(post_id)']." \">www.tickity-boo.co.uk/site/postview.php?post=".$post['MAX(post_id)']."</p>"; //$header.= "</html>"; //mail($remail,$subject,"","MIME=Version:1.0\r\n$header"); $mail = new PHPMailer(); $mail->IsSMTP(); // set mailer to use SMTP $mail->Host = "YOUR SMTP SERVER"; // specify main and backup server $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "YOUR SMTP USER NAME"; // SMTP username $mail->Password = "YOUR SMTP PASSWORD"; // SMTP password $mail->From = 'info@tickity-boo.co.uk'; $mail->FromName = ''; $mail->AddAddress($_POST['remail']); $mail->WordWrap = 50; // set word wrap to 50 characters $mail->IsHTML(true); // set email format to HTML $mail->Subject = $semail." has sent you an e-card"; $mail->Body.= "<html><p>Hi,</p>"; $mail->Body.= "<p>You have been sent an e-card from ".$sname."</p>"; $mail->Body.="<p>It can be viewed at <a href=\"http://www.tickity-boo.co.uk/site/postview.php?post=".$post['MAX(post_id)']." \">www.tickity-boo.co.uk/site/postview.php?post=".$post['MAX(post_id)']."</p>"; $mail->Body.= "</html>"; $mail->AltBody = "Your mailer does not support HTML, sorry."; $mail->Send(); } mysql_close($dataLink); ?> I also included the 3 files: class.phpmailer.php, class.smtp.php and phpmailer.lang-en.php in the same directory as as the postsend.php file , but now I get the error: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@tickity-boo.co.uk and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. To check my mail I use webmail provided with the hosting company. Many thanks again Aden