0

I am looking for a way to save my template file which I use as a certificate snf sttsch it to my my.

Below is the code to replace fields in my template with one I have queried.

require("class.phpmailer.php");

//placeholders array
$pholders = array('replace_name', 'replace_number', 'replace_title');

//Certificate replace values array
$failedValues = array($FullName, $TestNo, $Title);

$mail_body = file_get_contents("failed.html");
$mail_body = str_replace($pholders,$failedValues,$mail_body);

//mailer
$mail = new phpmailer;
$mail->IsSMTP(); // set mailer to use SMTP
$mail->IsHTML(true);    // set email format to HTML
$mail->Subject = "Results";
$mail->Body = $mail_body;
$mail->AddAttachment("cpd.html");

I have omitted code for the smtp setting. The file cpd.html has to be generated and attached. I am looking for a way on how to generate it and save it for attaching it to the mail.

Sithelo Ngwenya
  • 501
  • 2
  • 10
  • 28
  • 2
    You need to add `Content-Type` to your message. check this http://stackoverflow.com/questions/1666098/declaring-mime-type-for-html-email – TNK Mar 13 '13 at 12:04
  • @tnk Thanks for the response. I have checked the linked. I notice MIME and still trying to figure out how to implement it. – Sithelo Ngwenya Mar 13 '13 at 12:15

0 Answers0