通过 MailChimp 发送电子邮件 [英] Send an email via MailChimp

查看:53
本文介绍了通过 MailChimp 发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为问题出在 $api->listSubscribers()

include('../libs/mailchimp/MCAPI.class.php');

$options = array('list_id' => '$list_id', 'subject' => 'Prova', 'from_name' => 'name', 'from_email' => 'info@example.com');
$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?

推荐答案

这里有几个问题:

第一个是您没有在每次 API 调用后进行错误检查.如果您从底部取出错误检查代码并在 listSubscribe() 调用之后粘贴它,您将立即收到错误消息,因为您没有传递任何类型的订阅者数据(至少您需要电子邮件地址).listSubscribe 的文档是 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

一旦你这样做 - 除非你已经彻底阅读并考虑了 listSubscribe 文档中的选项 - 你的第二个问题将是你正在运行 listSubscribe 并将 double_optin 参数设置为 true(默认值),这意味着它们在点击确认电子邮件中的链接之前不会订阅.

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.

这篇关于通过 MailChimp 发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆