Php邮件程序缺少FromName的字符串

时间:2018-05-01 12:08:22

标签: php phpmailer

我正在使用PHPmailer版本5.2.22并从FromName中丢失部分字符串。

例如

使用FromName发送的邮件:“CONC,abcø”

输出FromName:“abcø”

从收到的邮件的FromName中删除字符串部分“CONC”。

代码示例:

<?php
    $email = 'waleedAhmed@mymail.com';
    $name = 'waleed';
    $event_info[0]['organizer_name'] = 'CONC, abcø';
    $subject = 'Testing..';
    $content = ' content : '. $event_info[0]['organizer_name'];

    $objName = new \PHPMailer();
    $objName->CharSet = 'UTF-8';
    $objName->Mailer = "smtp";
    $objName->Host = "mail.mymail.com";
    $objName->Port = 25;
    $objName->Mailer = "sendmail";
    $objName->From = 'donotreply@mymail.com';
    $objName->Sender = 'donotreply@mymail.com';
    $objName->FromName = $event_info[0]['organizer_name']
    $objName->IsHTML(true);
    $objName->Body = $content;
    $objName->Send();
    unset($objName);

1 个答案:

答案 0 :(得分:0)

// ' \"CONC, abcø\" < donotreply@mymail.com > ';   

$objName->FromName = '\"'.$event_info[0]['organizer_name'].'\" < donotreply@mymail.com >';

工作正常。