phpmail werkt niet als er een image in het html bericht zit
Heeft iemand een tip?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?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.';
?>
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.';
?>
Er zijn nog geen reacties op dit bericht.