Jump to content

phpmailer, set the MIME to html


kipper

Recommended Posts

I am using the phpmailer by Worx. My SEND() mail works except that it is not html. phpmailer created the object for me, but for the life of me, I can't find where to or how to implement it. I am attaching an html file:

$mail->MsgHTML(file_get_contents('newsletter.html')); but it defaults to sending in plain text AND, it lands in the SPAM folder.

Any advice would be helpful. Below my code will be phpmailers support file (require once

 

<CODE>

$mail = new PHPMailer();

$mail->IsSMTP();

$mail->Host  ="localhost";

$mail->Port  =25;

$mail->SMTPAuth = true;

$mail->Username = "[email protected]";

$mail->Password ="error7575";

 

$mail->FromName = $from_name;

$mail->From = $from;

$mail->AddAddress($to, $to_name);

$mail->AddCC($cc,$name='Brenda testing at the moment, cc is edwna');

$mail->Subject = $subject;

$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically

$mail->MsgHTML(file_get_contents('newsletter.html'));

$mail->AddAttachment('seo.pdf');      // attachment

 

 

$result = $mail->Send();

 

 

if($result) {

 

$message = "Your email was successfully sent";

 

} else {

 

$message = "There was an error in sending your email";

}

}

</CODE>

 

I have attched the phpmailer support file, too big to copy paste

 

 

 

[attachment deleted by admin]

Link to comment
https://forums.phpfreaks.com/topic/175534-phpmailer-set-the-mime-to-html/
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.