Jump to content

Small Error


pranshu82202

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/245301-small-error/
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.