首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在magento中一次向2个不同的用户发送2个不同的电子邮件?

如何在magento中一次向2个不同的用户发送2个不同的电子邮件?
EN

Stack Overflow用户
提问于 2015-09-23 21:00:11
回答 1查看 107关注 0票数 0

我已经在magento中创建了一个名为供应商投诉的自定义模块。在这里,供应商用户可以向管理员发送有关其投诉的邮件,管理员可以向该特定供应商用户发送回复邮件。所以我创建了2个不同的邮件模板,但是我不知道如何同时发送这两个模板。

现在我已经完成了向供应商用户发送回复电子邮件,但我还没有完成发送邮件给管理员用户。

我向供应商用户发送回复邮件的代码:

代码语言:javascript
复制
       /**sending email*/
            $emailTemplate = Mage::getModel('core/email_template')->loadDefault('vendor_complaints_email_template');

            //Getting the Store E-Mail Sender Name.
            $senderName = Mage::getStoreConfig('trans_email/ident_general/name');

            //Getting the Store General E-Mail.
            $senderEmail = Mage::getStoreConfig('trans_email/ident_general/email');

            //Variables for Confirmation Mail.
            $emailTemplateVariables = array();
            $emailTemplateVariables['name'] = $customerName;
            $emailTemplateVariables['email'] = $customerEmail;              

            //Appending the Custom Variables to Template.
            $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);

            //Sending E-Mail to Customers.
            $mail = Mage::getModel('core/email')
                ->setToName($customerName)
                ->setToEmail($customerEmail)
                ->setBody($processedTemplate)
                ->setSubject('ShopU Store : Vendor Complaints')
                ->setFromEmail($senderEmail)
                ->setFromName($senderName)
                ->setType('html');

                //echo "<pre>";
                //print_r($mail);
                //die;

             try{
                    //Confimation E-Mail Send
                    $mail->send();
                 }
             catch(Exception $error)
             {
                Mage::getSingleton('core/session')->addError($error->getMessage());
                return false;
             }

            /**end**/

谁能告诉我如何发送邮件给管理员用户也在同一时间?

提前谢谢..

EN

回答 1

Stack Overflow用户

发布于 2015-09-23 21:21:03

您可以合并这一点,但类似于:

代码语言:javascript
复制
//Sending E-Mail to Customers.
            $mail = Mage::getModel('core/email')
                ->setToName($customerName)
                ->setToEmail($customerEmail)
                ->setBody($processedTemplate)
                ->setSubject('ShopU Store : Vendor Complaints')
                ->setFromEmail($senderEmail)
                ->setFromName($senderName)
                ->setType('html');
             try{
                    //Confimation E-Mail Send
                    $mail->send();
                 }
             catch(Exception $error)
             {
                Mage::getSingleton('core/session')->addError($error->getMessage());
                return false;
             }

//Sending E-Mail to Admin.

        $emailTemplate = Mage::getModel('core/email_template')->loadDefault('vendor_complaints_email_temp‌​late_for_admin');
            $processedTemplate = $emailTemplate->getProcessedTemplate($emailTemplateVariables);
            $adminMail = Mage::getModel('core/email')
                ->setToName('Admin Name')
                ->setToEmail('admin@something.com')
                ->setBody($processedTemplate)
                ->setSubject('ShopU Store : Vendor Complaints')
                ->setFromEmail($senderEmail)
                ->setFromName($senderName)
                ->setType('html');

             try{
                    //Confimation E-Mail Send
                    $adminMail->send();
                 }
             catch(Exception $error)
             {
                Mage::getSingleton('core/session')->addError($error->getMessage());
                return false;
             }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32740322

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档