使用php邮件发送邮件时出现问题

时间:2012-03-21 07:26:36

标签: php phpmailer

我使用php邮件程序类发送了一封电子邮件。邮件发送成功但我收到的邮件内容为'徽标1'。我正在使用以下代码..任何人请帮助

<?
include_once 'editors/tinymce.php';
$to = 'test@test.com';
$frm = 'test1@test1.com';
$sub = 'Weekly Working Report';

$mail_body = include_once('mail_content.php');
$mailstatus = l_mail('', '', $to, '', $frm, '', $sub, $mail_body);

if ($mailstatus == 'ok') {
    echo '<center><font color=red style="font-size:14px">Message has been sent Succesfully.....!</font></center><br>';
} else {
    echo $mailstatus;
}
?>

3 个答案:

答案 0 :(得分:2)

你不应该写为$mail_body = include_once('mail_content.php'); 相反,

include_once 'editors/tinymce.php';
$to = 'test@test.com';
$frm = 'test1@test1.com';
$sub = 'Weekly Working Report';

    ob_start(); // start output buffering
    include_once('mail_content.php');
    $mail_body = ob_get_contents(); // get the contents from the buffer
    ob_end_clean();

$mailstatus = l_mail('', '', $to, '', $frm, '', $sub, $mail_body);

if ($mailstatus == 'ok') {
    echo '<center><font color=red style="font-size:14px">Message has been sent Succesfully.....!</font></center><br>';
} else {
    echo $mailstatus;
}

答案 1 :(得分:0)

$to = "pbvamsi@gmail.com";
 $subject = "Hey keep belief in me!";
 $body = "Hi,\n\nHow are you?\n\n be good do good";
 $header="god@heaven.com";
 if (mail($to, $subject, $body, $header)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }

我希望这有效

答案 2 :(得分:0)

在创建phpmailer类的对象时使用以下代码

$mail = new phpmailer();
$mail->IsHTML(true);

感谢