简体   繁体   English

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

[英]issue while sending mail using php mailer

I have send an email using php mailer class. 我已经使用php邮件程序类发送了一封电子邮件。 mail was sending successfully but I got the mail content as 'logo 1'. 邮件发送成功但我收到的邮件内容为'徽标1'。 am using the following code.. anybody please help 我正在使用以下代码..任何人请帮助

<?
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;
}
?>

you shouldn't write as $mail_body = include_once('mail_content.php'); 你不应该写为$mail_body = include_once('mail_content.php'); instead, 代替,

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;
}
$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>");
  }

I hope this works 我希望这有效

use the below code when you create object of the phpmailer class 在创建phpmailer类的对象时使用以下代码

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

thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM