我想在我的网站上发布简报,我使用以下插件:
https://github.com/edap/cakephp-newsletter-plugin
我已经按照以下步骤操作了:
第1步:http://iandeth.dyndns.org/mt/ian/archives/20120110-cakephp-extendassociations-behavior/ExtendAssociations2Behavior.txt
将其保存在Models/Behavior/ExtendAssociationsBehavior.php
步骤2:您必须在Appcontroller中有一个sendEmail()函数,例如关注
public function sendEmail($subject, $message, $address) {
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail('default');
$email->from(array('your@email.com' => 'My Site'));
$email->to($address);
$email->subject($subject);
$email->send($message);
}
第3步:将插件文件放在文件夹app/Plugins/Newsletter/
步骤4:使用app/plugins/newsletter/config/sql/schema.sql
第5步:将此变量添加到app/Config/bootstrap.php
文件
我陷入了下一步:
第6步:JQuery for admin_send.ctp
第7步:解释配置字段
$subject = Configure::read('Newsletter.unsubscribe_subject');
$subject = Configure::read('Newsletter.subscribe_subject');
$from = Configure::read('Newsletter.from'); #Required
$from_email = Configure::read('Newsletter.from_email'); #Required
$subject = Configure::read('Newsletter.sendX'); #Number of emails to sent at each admin_send call.
$subject = Configure::read('Newsletter.sendInterval'); #the interval time before send next batch
$subject = Configure::read('Newsletter.mail_opt_out_message');
$subject = Configure::read('Newsletter.emptyImagePath');
任何人都可以帮助我吗?如何添加表单以便用户输入他们的电子邮件?
答案 0 :(得分:0)
我不知道,为什么在这里引导程序中使用了Configure :: read 将以下全局变量添加到app / Config / bootstrap.php:
Configure::write('Newsletter.unsubscribe_subject','Text for unsubscribe...');
Configure::write('Newsletter.subscribe_subject','Text for you subscribe subject... ');
Configure::write('Newsletter.from','Your Name here..'); #Required
Configure::write('Newsletter.from_email','Your e-mail here...'); #Required
Configure::write('Newsletter.confirm_url','http://www.example.com/YourAppname/newsletter/subscriptions/confirm_subscription/'); #Required
Configure::write('Newsletter.sendX',100); #Number of emails to sent at each admin_send call.
Configure::write('Newsletter.sendInterval',100); #the interval time before send next batch
Configure::write('Newsletter.mail_opt_out_message','Opt out message here...');
Configure::write('Newsletter.emptyImagePath','no clue what that is...');
如果您想查看订阅表单,您的网址应如下所示:
http://www.yourwebsite.com/yourapp/newsletter/subscriptions/subscribe
我希望这有帮助..
答案 1 :(得分:0)
将此插件用于CakePHP中的简报。 Cake2 newsletter