1

我正在使用 yii 框架开发邮件发送功能。我正在使用链接=“http://www.yiiframework.com/extension/mailer”上给出的邮件扩展。我已经在扩展文件夹中添加了所有文件。我已经用代码制作了单独的类文件 -

 public function sendEmail($FromEmail,$ToEmail,$Subject,$Message)
    {
        $settings=new Settings();
        $mailer = Yii::createComponent('application.extensions.mailer.EMailer');
        $mailer->IsSMTP();
        $mailer->IsHTML(true);
        $mailer->SMTPAuth = true;
        $mailer->SMTPSecure = 'ssl';
        $mailer->Host =$settings->Host;
        $mailer->Port =$settings->Port;
        $mailer->CharSet = 'UTF-8';
        $mailer->Username =$FromEmail; 
        $mailer->Password ='';
        $mailer->FromName = 'feedback@balaee.com';
        $mailer->AddAddress($ToEmail);
        $mailer->Subject = $Subject;
        $mailer->IsHTML(true);
        $mailer->Body=$Message;
        if($mailer->Send())
        {
            echo "Mail send Successfully.Please you have check mail ";
        }
        else
        {
            echo "Fail to send your message!";
        }
    }

所以它工作正常。它根据需要发送电子邮件。但我想在使用它时包含“cc”和“bcc”参数以维护安全性。那么如何使用邮件扩展程序使用“cc”和“bcc”?

4

1 回答 1

2

根据原始 PHPMailer 的 Github 主页上的README.md,您只需调用$mailer->AddCC('recipient@example.com');. 密件抄送同样简单:$mailer->AddBCC('another_recipient@example.com');.

我提到 PHPMailer 的原因是yii 扩展页面也是如此。

于 2013-04-29T10:10:03.333 回答