在codeigniter中维护邮件中的xml格式

时间:2023-01-14 10:46:19

I have a mail function in codeigniter which is sending xml data but in my mail its not showing in proper format Here in the below code $result contains data in xml format.

我在codeigniter中有一个邮件功能,它发送xml数据但在我的邮件中它没有以正确的格式显示在下面的代码中$ result包含xml格式的数据。

public function send_mail($id,$result){
    require_once 'phpmailer/PHPMailerAutoload.php';
    $mailto = "test@gmail.com";
    $name   = "Testing";
    $content= "Result - $result <br>";
    $subject= "Test Mail - $id : ";

    $mail = new PHPMailer;

        $mail->isSendmail();
        $mail->setFrom('admin@mywebsite.com', 'Tester');           
        $mail->addAddress($mailto, $name);
        $mail->Subject = $subject;
        $mail->msgHTML($content);

    if ($mail->send()) {
        return true;
    }else{
        return false;
    }

}

1 个解决方案

#1


0  

Add this :

添加这个:

$mail = new PHPMailer;
$mail->IsHTML(true);
...

#1


0  

Add this :

添加这个:

$mail = new PHPMailer;
$mail->IsHTML(true);
...