CAKE电子邮件不接受各种bcc / cc选项

时间:2015-08-13 20:20:36

标签: email cakephp

我尝试了很多蛋糕选项,包含ccbcc或附加电子邮件的发票,没有任何效果,我需要一个可行的示例,格式如下,我还没有找到任何明确的溶液

    public function send() {

        $id = $this->request->data['Invoice']['id'];
        $invoiceNumber = $this->request->data['Invoice']['invoice_number'];
        $to = $this->request->data['Invoice']['to'];
        $from = $this->request->data['Invoice']['from'];
        $message = $this->request->data['Invoice']['message'];

        App::uses('CakeEmail', 'Network/Email');

        $email = new CakeEmail();
        $email->config(array(
            'from' => $from, 
            'transport' => 'Mail',
            'charset' => 'utf-8',
            'headerCharset' => 'utf-8'
            ));


        $result = $email->emailFormat('html')
            ->to($to) 
            ->addbcc('WCMBilling@icloud.com')
            ->from($from)
            ->returnPath($from)
            ->subject('New Invoice ('.$invoiceNumber.')')
            ->attachments(WWW_ROOT.'/temp/Invoice_'.$invoiceNumber.'.pdf')
            ->send($message);

        unlink(WWW_ROOT.'/temp/Invoice_'.$invoiceNumber.'.pdf');

        $this->Session->setFlash('Email Sent');
        $this->redirect(array('controller'=>'invoices', 'action'=>'view', $id));
    }

0 个答案:

没有答案