prabpornpra / cakephp-mailchimp
CakePHP 2.x 邮件chimp插件
v1.0.4
2014-03-11 23:27 UTC
Requires
- php: >=5.3.0
- composer/installers: ~1.0
This package is not auto-updated.
Last update: 2024-09-28 16:31:00 UTC
README
该插件专为 CakePHP 使用。
安装
可以通过 Composer 或 git 子模块安装。Composer
composer install
如果你已经使用 composer
composer update
Git 子模块
git submodule add https://github.com/prabpornpra/MailChimp.git pathForYourPluginFolder/nameThePlugin
配置
对于 CakePHP 2.0,插件需要在 app/Config/bootstrap.php 中手动加载。
CakePlugin::load('MailChimp')
在 app/Config 中创建一个 php 文件,命名为 mail_chimp.php
。在 mail_chimp.php 中添加以下代码。
$config['Chimp']['url'] = 'api.mailchimp.com/';
$config['Chimp']['key'] = "Your API Key from your MailChimp account"
$config['Chimp']['version'] = '2.0';
$config['Chimp']['lists_subscribe'] = '/lists/subscribe';
$config['Chimp']['lists_member_info'] = '/lists/member-info';
用法
版本 1.0* 有两种方法
订阅电子邮件
将电子邮件添加到订阅列表中
listSubscribe($listId, $params)
$listId: 要连接的列表 ID,你可以从你的 MailChimp 账户中获取。
$params: 要订阅的电子邮件 Ex
$params = array (
'email' => array('email' => 'your email')
);
你可以在 $params 中添加更多选项,查看格式在,http://apidocs.mailchimp.com/api/2.0/lists/subscribe.php 如果该方法调用成功,将向希望订阅的电子邮件发送确认邮件。
检查订阅列表中的电子邮件状态
getEmailStatus($listId, $email)
$listId: 要连接的列表 ID,你可以从你的 MailChimp 账户中获取。
$email: 你想检查状态的电子邮件
此方法将返回一个字符串状态。
Pending: The email confirmation is sent to this email, but the user haven't response yet.
Subscribe: This email is already subscribe in the list.
Unsubscribe: This email is unsubscribe in the list.
Not subscribe: This email haven't been subscribe in the list before.
许可证
MIT 许可证 请参阅 LICENSE 文件。