使用php邮件发送邮件时出现问题
问题描述:
I have send an email using php mailer class. mail was sending successfully but I got the mail content as 'logo 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;
}
?>
我使用php邮件程序类发送了一封电子邮件。 邮件发送成功但我收到的邮件内容为'徽标1'。 我正在使用以下代码..任何人请帮助 p>
&lt;?
include_once'editors / tinymce.php';
$ to ='test@test.com';
$ frm ='test1@test1.com';
$ sub ='每周工作报告';
$ mail_body = include_once('mail_content.php');
$ mailstatus = l_mail('', '',$ to,'',$ frm,'',$ sub,$ mail_body);
if($ mailstatus =='ok'){
echo'&lt; center&gt;&lt; font color = red style =“font-size:14px”&gt;消息已成功发送.....!&lt; / font&gt;&lt; / center&gt;&lt; br&gt;';
}其他{
echo $ mailstatus; \ n}
?&gt;
code> pre>
div>
答
you shouldn't write as $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,
How are you?
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
$mail = new phpmailer();
$mail->IsHTML(true);
thanks