Php 在Zend 1中使用mandrill作为邮件传输层
目前,我正在尝试将Mandrill功能集成到Zend 1遗留应用程序中,我对它们处理邮件传输的方式不太熟悉。目前,我正在包括Php 在Zend 1中使用mandrill作为邮件传输层,php,zend-framework,mandrill,Php,Zend Framework,Mandrill,目前,我正在尝试将Mandrill功能集成到Zend 1遗留应用程序中,我对它们处理邮件传输的方式不太熟悉。目前,我正在包括mandrill/mandrillcomposer包,并试图遵循Zend 1中包含的其他传输层的模式: class MandrillTransport extends Zend_Mail_Transport_Abstract { private $message = array(); protected function _formatMandrillAr
mandrill/mandrill
composer包,并试图遵循Zend 1中包含的其他传输层的模式:
class MandrillTransport extends Zend_Mail_Transport_Abstract
{
private $message = array();
protected function _formatMandrillArray()
{
//grab all the relavant data from the pre-existing mail object and put it into a Mandrill-friendly array
}
protected function _getAttachments() {
//loop through and format attachments that get added to array
}
protected function _sendMail()
{
//send Mandrill message with included data
$mandrill = new Mandrill(Zend::registry('config')->mandrill->APIKey);
$mandrill->messages->send($this->message);
}
public function send() {
//Format all the stuff and send it
}
}
然后我假设我可以在“send()”函数中使用它,它似乎将传输作为一个参数:
//TODO: Put this in a better spot
require_once __DIR__ . "/ZendFramework/Zend/Mail/Transport/MandrillTransport.php";
$tr = new MandrillTransport();
$email->send($tr);
我走对了吗?我之所以希望将其作为传输层,而不仅仅是剥离现有代码并用Mandrill替换它,是因为有许多不同的业务流程发送邮件,我们希望能够选择哪些使用Sendmail传输,哪些使用Mandrill
提前感谢,,
-克里斯你是否已经确定自己是否走上了正确的道路?我正在考虑做同样的事情。