是否可以通过编程方式在Magento中发送电子邮件? [英] Is it possible to send an e-mail programmatically in Magento?

查看:145
本文介绍了是否可以通过编程方式在Magento中发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过编程方式在Magento中发送电子邮件?可能来自自定义模块中的控制器,您可以抓住模板,填充其变量并发送电子邮件吗?

Is it possible to send an e-mail programmatically in Magento? Maybe from a controller in a custom module, could you get hold of a template, populate its variables, and send the e-mail?

谢谢。

推荐答案

绝对。以下是Google Checkout助手的示例:

Absolutely. Here's an example from the Checkout helper:

$mailTemplate = Mage::getModel('core/email_template');   
$template = Mage::getStoreConfig('checkout/payment_failed/template', $checkout->getStoreId()); 
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>$checkout->getStoreId()))
    ->sendTransactional(
        $template,
        Mage::getStoreConfig('checkout/payment_failed/identity', $checkout->getStoreId()),
        $recipient['email'],
        $recipient['name'],
        array(
            'reason' => $message,
            ...
            'total' => $total
        )
    );   

这篇关于是否可以通过编程方式在Magento中发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆