Send a fancy mail with PHPMailer from Beefree

I want to send an email with PHPMailer. The mail is a HTML made up mail with Beefree. First the whole email was a PHP variable, but then I get the email with the first part repeated. I think this is a result of having a head in the body, but I'm not sure.

To clear this out the mail I want to send is this (with fancy lay-out):

[image]
Hello John,

How are you?

Best regards!

But it is send like this:

[image]
Hello $name,

[image]
Hello $name,

<div style="Margin: 0 auto;min-width: 320px;max-width: 600px;ov

Now I saved my mail as beefree.php. It is possible to send it like this:

$mail->msgHTML(file_get_contents('beefree.php'));

The file is now send with a correct lay-out, but with variables, like 'Hello $name'.

To solve this I can do this:

ob_start();
include 'beefree.php'; //execute the file as php
$body = ob_get_clean();

and send it like this:

$mail->msgHTML($body);

Then the variables are inserted, I see the real name, but the email is like the second mail-example, except the real name is visible. The problem is why it has repeated parts and not the whole email. How can I send the mail like in the file_get_contents, but with the correct variables?

链接地址: http://www.djcxy.com/p/69346.html

上一篇: 面对邮件功能的问题

下一篇: 用Beefree的PHPMailer发送一个奇特的邮件