magento send email
来源:互联网 发布:知敬畏守底线 编辑:程序博客网 时间:2024/05/23 18:58
protected function _sendEmailTemplate($template, $sender, $templateParams = array(), $storeId = null)
{
/** @var $mailer Mage_Core_Model_Email_Template_Mailer */
$mailer = Mage::getModel('core/email_template_mailer');
$emailInfo = Mage::getModel('core/email_info');
$emailInfo->addTo($this->getEmail(), $this->getName());
$mailer->addEmailInfo($emailInfo);
// Set all required params and send emails
$mailer->setSender(Mage::getStoreConfig($sender, $storeId));
$mailer->setStoreId($storeId);
$mailer->setTemplateId(Mage::getStoreConfig($template, $storeId));
$mailer->setTemplateParams($templateParams);
$mailer->send();
return $this;
}
app/code/core/mage/core/model/email/template/mailer.php send()->app/code/core/mage/core/model/email/template.php[sendTransactional()]
###################################################
if (is_numeric($templateId)) {
$this->load($templateId);} else {
$localeCode = Mage::getStoreConfig('general/locale/code', $storeId);
$this->loadDefault($templateId, $localeCode); // when select default template fromlocale
}
###################################################
->app/code/core/mage/core/model/email/template.php[send()]
->lib/zend/mail.php[send()]
->lib/zend/mail/transport/abstract.php[send()]
->lib/zend/mail/transport/sendmail.php[_sendMail()]
###################################################
public function _sendMail()
{
if ($this->parameters === null) {
set_error_handler(array($this, '_handleMailErrors'));
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header);
restore_error_handler();
} else {
if(!is_string($this->parameters)) {
/**
* @see Zend_Mail_Transport_Exception
*
* Exception is thrown here because
* $parameters is a public property
*/
#require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception(
'Parameters were set but are not a string'
);
}
set_error_handler(array($this, '_handleMailErrors'));
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header,
$this->parameters);
restore_error_handler();
}
if ($this->_errstr !== null || !$result) {
/**
* @see Zend_Mail_Transport_Exception
*/
#require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception('Unable to send mail. ' . $this->_errstr);
}
}
{
if ($this->parameters === null) {
set_error_handler(array($this, '_handleMailErrors'));
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header);
restore_error_handler();
} else {
if(!is_string($this->parameters)) {
/**
* @see Zend_Mail_Transport_Exception
*
* Exception is thrown here because
* $parameters is a public property
*/
#require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception(
'Parameters were set but are not a string'
);
}
set_error_handler(array($this, '_handleMailErrors'));
$result = mail(
$this->recipients,
$this->_mail->getSubject(),
$this->body,
$this->header,
$this->parameters);
restore_error_handler();
}
if ($this->_errstr !== null || !$result) {
/**
* @see Zend_Mail_Transport_Exception
*/
#require_once 'Zend/Mail/Transport/Exception.php';
throw new Zend_Mail_Transport_Exception('Unable to send mail. ' . $this->_errstr);
}
}
###################################################
system.xml
add configuration here
config.xml
add configuration here
put the file order.html in app/locale/your language/template/email/notifyemail/
0 0
- magento send email
- magento 发送邮件,通过magento的机制发送邮件 - magento send custom email
- send email
- send email
- Email--Send
- Send Email
- magento email
- Send Email 发送邮件
- C# 2.0 send email
- Oracle send Email
- Send email in ABAP
- Send html Email
- Oracel Send Email...
- Sql Server Send Email...
- Java Mail send email
- Send email with attachment
- how to send email
- powershell send email
- HDU1875畅通工程再续
- 第一部分 字符、常量、变量、运算符
- Python的Pexpect详解
- 原始JS选择器使用方法和常用事件手册
- 纷纷大幅度华国锋减肥减肥杭钢股份飞过海
- magento send email
- 线程的那些事儿
- poj——3159——Candies(spfa)
- struts2框架校验
- JAVA分页实现,用java写一个分页功能的代码
- Wifi共享精灵中关于虚拟网卡的问题
- UVA 11729 Commando War
- 三部委通知放开非公立医疗机构服务价格
- 深复制体验(一)