Ik probeer voor het eerst iets te mailen met phpmailer in HTML formaat. Dat gaat goed tot ik de regel met <img> toevoeg. Dan wordt er helemaal niet gemaild. Als het jpg bestand van de <img> niet bestaat, dan wordt er wel gemaild. Het ligt niet aan het plaatje, want ik heb meerdere plaatjes gebruikt.
Heeft iemand een tip?

<?php
require 'phpmailer/class.phpmailer.php';
//try {
$mail = new PHPMailer(true); //New instance, with exceptions enabled
$body = '
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Email test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<table><tr><td>Test</td><td> nog een</td></tr></table>
<p>Here is a test HTML email</p>
<img border="0" src="logo.jpg">

</body>
</html>
';
$body = preg_replace('/\\\\/','', $body); //Strip backslashes
$mail->IsSMTP(); // tell the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Port = 25; // set the SMTP server port
$mail->Host = "mail.yourdomain.com"; // SMTP server
$mail->Username = "[email protected]"; // SMTP server username
$mail->Password = "password"; // SMTP server password
$mail->IsSendmail(); // tell the class to use Sendmail
$mail->AddReplyTo("[email protected]","First Last");
$mail->From = "[email protected]";
$mail->FromName = "First Last";
$to = "[email protected]";
$mail->AddAddress($to);
$mail->Subject = "First PHPMailer Message";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->WordWrap = 80; // set word wrap
$mail->MsgHTML($body);
$mail->IsHTML(true); // send as HTML
$mail->Send();
echo 'Message has been sent.';
?>

Reageren