Laravel Spatie/Newsletter doesn't add contact in Mailchimp
我正在研究laravel 5.2应用程序与MailChimp之间的集成。我已经下载并安装了spatie / newsletter https://github.com/spatie/laravel-newsletter,但由于某些原因导致集成无法正常工作,这意味着未在mailchimp中创建联系人。我在config / app.php文件中添加了提供程序和别名,config / larave-newsletter.php文件包含正确的设置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | /* * The api key of a MailChimp account. You can find yours here: * https://us10.admin.mailchimp.com/account/api-key-popup/ */ 'apiKey' => env('MAILCHIMP_APIKEY'), /* * When not specifying a listname in the various methods, use the list with this name */ 'defaultListName' => 'ListName', /* * Here you can define properties of the lists you want to * send campaigns. */ 'lists' => [ /* * This key is used to identify this list. It can be used * in the various methods provided by this package. * * You can set it to any string you want and you can add * as many lists as you want. */ 'subscribers' => [ /* * A mail chimp list id. Check the mailchimp docs if you don't know * how to get this value: * http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id */ 'id' => env('MAILCHIMP_LIST_ID'), ], ], /* * If you're having trouble with https connections, set this to false. */ 'ssl' => true, |
我的控制器包含以下内容:
1 | Newsletter::subscribe($user->email, ['FNAME'=>$user->first_name, 'LNAME'=>$user->last_name]); |
奇怪的是,当我使用修补程序添加联系人时,它确实可以工作
Newsletter::subscribe($user->email, ["FNAME"=>$user->first_name,"LNAME"=>$u
ser->last_name]);
是否有针对此问题的解决方法,我该如何解决?谢谢
我能够通过将默认ssl设置从true更改为false来解决此问题。看来我的服务器与https连接存在一些问题。
如果有人遇到类似的问题,他们可以尝试在config / laravel-newsletter.php文件中设置'ssl'=> false,也许可以解决他们的问题。
我解决了相同的问题
运行以下命令:
- 作曲家安装
- php artisan config:缓存
- PHP的工匠路线:缓存