xlabs/ynotmailbundle
Composer 安装命令:
composer require xlabs/ynotmailbundle
包简介
YNotMail bundle
README 文档
README
YNot Mail API wrapper.
Installation
Install through composer:
php -d memory_limit=-1 composer.phar require xlabs/ynotmailbundle
In your AppKernel
public function registerbundles()
{
return [
...
...
new XLabs\YNotMailBundle\XLabsYNotMailBundle(),
];
}
Add the following command as a crontab to update YNotMail user lists:
55 23 * * * /usr/bin/php <symfony_project_folder>/bin/console cron:daily:ynot:update_lists
Configuration sample
Default values are shown below:
# app/config/config.yml
x_labs_ynot_mail:
api:
url: 'https://www.ynotmail.com/clients/remote-api.php'
username: ############
token: ############
lists:
expired_members: {id: xxxx, query: "SELECT * FROM..."}
alias_2: {id: <list_id_2>, query: "SELECT * FROM..."}
...
alias_N: {id: <list_id_N>, query: "SELECT * FROM..."}
...
Usage
Instantiate the service from a Controller by:
$api = $this->get('xlabs_ynot_mail');
Then use the "_call" method to perform the request, which uses 3 parameters: method, parameters, and multiple flag. If "multiple" is true, it will expect an array of parameters. If the parameter was already an array, it will expect an array of arrays.
Methods
Create list
$api->_call('createList', array(
'name' => 'test',
'ownerEmail' => 'test_owner@mm.com',
'ownerName' => 'test',
'replyEmail' => 'test_reply@mm.com',
'companyName' => 'test',
'companyAddress' => 'test',
'companyPhones' => 'test'
));
Get lists
$api->_call('getLists');
Delete list
$api->_call('deleteList', $list_id);
Add subscriber to list
$api->_call('addSubscriberToList', array(
'listId' => $list_id,
'subscriber' => array(
'email' => 'my@email.com',
'format' => 'html'
)
));
A multiple call to add multiple subscribers to a list would look as follows:
$api->_call('addSubscriberToList', array(
array(
'listId' => $list_id,
'subscriber' => array(
'email' => 'first@email.com',
'format' => 'html'
)
),
array(
'listId' => $list_id,
'subscriber' => array(
'email' => 'second@email.com',
'format' => 'html'
)
)
), $multiple = true);
Delete subscriber from list
$api->_call('deleteSubscriber', array(
'listId' => $list_id,
'subscriberId' => 'my@email.com'
));
统计信息
- 总下载量: 210
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-14