本文介绍了如何在magento中添加密件抄送或抄送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我不知道如何在以下编码中添加抄送或密件抄送.我尝试了密件抄送,但邮件无法通过.请一些帮助!..

I don't know how to add cc or bcc in the following codings .. I tried bcc but mail can't go. Please some one help!..

代码是

$data = array('name' => $username, 'to_user_id' => $to_userid, 'email' => $email, 'telephone' => $telephone, 'title' => $title, 'ip' => $ip, 'message' => $message);

            $templateId =1;
            $sender = Array('name' => "Admin", 'email' => "[email protected]");
            $useremail = $product_user;
            $emailName = $username;
            $vars = array('username' => $username, 'telephone' => $telephone, 'mail_id' => $email, 'title' => $title, 'message' => $message, 'object' => $this);
            $storeId = Mage::app()->getStore()->getId();
            $mailSubject = 'mail check';
            $translate = Mage::getSingleton('core/translate');
            $translate->setTranslateInline(false);
            Mage::getModel('core/email_template')
                ->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
                ->setTemplateSubject($mailSubject)
                ->setBcc('[email protected]')
                ->sendTransactional($templateId, $sender, $useremail, $emailName, $vars, $storeId);
            $translate->setTranslateInline(true);

                $model = Mage::getModel("contacts/contacts")->setData($data)->save();


            Mage::getSingleton("core/session")->addSuccess("You have been successfully sent your mail..");
            $this->_redirectReferer();
            return;

推荐答案

您可以使用 addBcc('[email protected]')代替 setBcc('[email protected]).com')或像这样修改您的代码

You can either use addBcc('[email protected]') instead of setBcc('[email protected]') in your code or modify your code like this

//mail transaction
$mail = Mage::getModel('core/email_template');
$mail->getMail()->addCc('[email protected]');
$mail->addBcc('[email protected]')
    ->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))
    ->setTemplateSubject($mailSubject)
    ->sendTransactional($templateId, $sender, $useremail, $emailName, $vars, $storeId);

这篇关于如何在magento中添加密件抄送或抄送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 01:57