Is it possible to send an e-mail programmatically in Magento?

后端 未结 2 1758
伪装坚强ぢ
伪装坚强ぢ 2021-01-14 18:42

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

2条回答
  •  感情败类
    2021-01-14 19:29

    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
            )
        );   
    

提交回复
热议问题