pranshu82202 Posted August 20, 2011 Share Posted August 20, 2011 i am using a php mail scriot which is perfectly sending emails... <?php require("class.phpmailer.php"); // path to the PHPMailer class $to=$_POST['email']; $msg='<html> <body><h1>My HTML Message</h1> <p>This is text</p> </body> </html>'; $sub=$_POST['sub']; $mail = new PHPMailer(); $mail->IsSMTP(); // telling the class to use SMTP $mail->Mailer = "smtp"; $mail->Host = "mail.mydomain.com"; //$mail->Port = 587; $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "[email protected]"; // SMTP username $mail->Password = "password"; // SMTP password $file = './abc.txt'; // attachment $mail->addAttachment('./attachment.jpeg'); $mail->From = "USER"; $mail->AddAddress("$to"); $mail->Subject = "$sub"; $mail->Body = "$msg"; $mail->WordWrap = 50; if(!$mail->Send()) { echo 'Message was not sent.'; echo 'Mailer error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent.'; } } ?> Every thing is working fine.. But when i paste any html thing in the $msg variable i got just the source code... Any assistance will be very helpfull... [email protected] Quote Link to comment https://forums.phpfreaks.com/topic/245301-small-error/ Share on other sites More sharing options...
codefossa Posted August 20, 2011 Share Posted August 20, 2011 $msg = htmlspecialchars($_POST['message']); Quote Link to comment https://forums.phpfreaks.com/topic/245301-small-error/#findComment-1259893 Share on other sites More sharing options...
pranshu82202 Posted August 20, 2011 Author Share Posted August 20, 2011 Kira i updated my code ... Have a look .. When i run this php file i only got the source code.. htmlspecialchar does not worked also Thanx Quote Link to comment https://forums.phpfreaks.com/topic/245301-small-error/#findComment-1259897 Share on other sites More sharing options...
pranshu82202 Posted August 20, 2011 Author Share Posted August 20, 2011 Is anyone their ??? to solve HTML EMAILS Quote Link to comment https://forums.phpfreaks.com/topic/245301-small-error/#findComment-1259908 Share on other sites More sharing options...
pranshu82202 Posted August 20, 2011 Author Share Posted August 20, 2011 Is anyone their ??? to solve HTML EMAILS Quote Link to comment https://forums.phpfreaks.com/topic/245301-small-error/#findComment-1259909 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.