通过 MailChimp 发送电子邮件
我认为问题出在 $api->listSubscribers()
include('../libs/mailchimp/MCAPI.class.php');
$options = array('list_id' => '$list_id', 'subject' => 'Prova', 'from_name' => 'name', 'from_email' => '[email protected]');
$content = array('html' => '<p>Testo di prova</p>');
$api = new MCAPI($apikey);
$campaignId = $api->campaignCreate('trans', $options, $content);
$api->listSubscribe($options['list_id']);
$api->campaignSendNow($campaignId);
if ($api->errorCode){
echo "Unable to Create New Campaign!";
echo "\n\tCode=".$api->errorCode;
echo "\n\tMsg=".$api->errorMessage."\n";
} else {
echo "New Campaign ID:".$campaignId ."\n";
}
为什么它不发送电子邮件?
I think problem is around $api->listSubscribers()
include('../libs/mailchimp/MCAPI.class.php');
$options = array('list_id' => '$list_id', 'subject' => 'Prova', 'from_name' => 'name', 'from_email' => '[email protected]');
$content = array('html' => '<p>Testo di prova</p>');
$api = new MCAPI($apikey);
$campaignId = $api->campaignCreate('trans', $options, $content);
$api->listSubscribe($options['list_id']);
$api->campaignSendNow($campaignId);
if ($api->errorCode){
echo "Unable to Create New Campaign!";
echo "\n\tCode=".$api->errorCode;
echo "\n\tMsg=".$api->errorMessage."\n";
} else {
echo "New Campaign ID:".$campaignId ."\n";
}
Why does'nt it send an email?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有几个问题:
第一个问题是您没有在每次 API 调用后进行错误检查。如果您从底部获取错误检查代码并将其粘贴在 listSubscribe() 调用之后,您将立即收到错误,因为您没有传递任何类型的订阅者数据(至少您需要电子邮件地址)。 listSubscribe 的文档位于此处
一旦你这样做了 - 除非你已经彻底阅读并考虑了 listSubscribe 文档中的选项 - 您的第二个问题是您正在运行 listSubscribe 并将 double_optin 参数设置为 true (默认值),这意味着在单击确认电子邮件中的链接之前它们不会被订阅。
接下来,该代码只会给您带来麻烦,而且可能很快就会给您带来麻烦。如果您打算使用伪交易营销活动,则必须为每种类型的电子邮件只创建一个伪交易营销活动,然后一遍又一遍地发送该营销活动。这就是他们的工作方式。不这样做会导致您的帐户充满一大堆垃圾广告系列,此时使用伪反式广告系列是没有意义的,因为这与创建/发送常规广告系列给单个用户相同超过。
You have a several issues here:
The first one is that you are not doing error checking after each API call. If you take the error checking code from the bottom and stick it after the listSubscribe() call, you'll immediately get an error because you aren't passing any sort of subscriber data (at the very least you need the email address). The docs for listSubscribe are here
Once you do that - unless you've thoroughly read and considered the options in the listSubscribe docs - your second issue is going to be that you are running listSubscribe with the double_optin parameter set to true (the default), which means they won't be subscribed until clicking a link in the confirmation email.
Next, that code is just going to get you in trouble, and probably quickly. If you are going to use psuedo-transcational campaigns it is imperrative that you only create ONE psuedo-trans campaign per type of email and then send that campaign over and over. That's how they are intended to work. Not doing that is going to cause you to fill up your account with a whole bunch of trash campaigns at which point there's no point in using a psuedo-trans campaign since that's the same as creating/sending a regular campaign to a single user over and over.
你有任何错误吗?
您似乎没有包含 api 密钥,它应该如下所示:
而不是:
您从 api 仪表板获取 API 密钥: http://admin.mailchimp.com/account/api
Do you get any errors?
It seems you are not including the api key, it should look like:
Instead of:
You get the API Key from your api dashboard: http://admin.mailchimp.com/account/api