westdc-core/Westdc/Mail/Sender.php

45 lines
1022 B
PHP
Raw Normal View History

2014-12-24 16:38:23 +00:00
<?php
/**
* Created by PhpStorm.
* User: Li Jianxuan
* Date: 14-9-19
* Time: 下午3:43
*/
namespace Westdc\Mail;
use Zend\ServiceManager\ServiceManager;
use Zend\ServiceManager\ServiceManagerAwareInterface;
class Sender implements ServiceManagerAwareInterface{
protected $serviceManager;
public function setServiceManager(ServiceManager $serviceManager)
{
$this->serviceManager = $serviceManager;
return $this;
}
public function backend($options)
{
$cmd = "php ".CURRENT_BOOTSTRAP_SCRIPT;
$cmd .= ' mail send';
$cmd .= ' --email="'.$options['email'].'"';
$cmd .= ' --name="'.$options['name'].'"';
$cmd .= ' --template="'.$options['template'].'"';
if(isset($options['data']))
{
$data = json_encode($options['data']);
$cmd .= ' --data=\''.$data.'\'';
}
$tools = $this->serviceManager->get('Tools');
2014-12-25 03:49:51 +00:00
$tools->execBackend($cmd);
2014-12-24 16:38:23 +00:00
return true;
}
}