【问题标题】:sending email using mail chimp api使用 mailchimp api 发送电子邮件
【发布时间】:2012-08-13 12:55:36
【问题描述】:

我正在尝试使用 mail chimp api 发送电子邮件,但出现以下错误

{"aws_type":null,"aws_code":null,"http_code":500,"message":"Invalid Mailchimp API Key: <snip>-us5 . You are accessing the wrong datacenter - your client library may not properly support our datacenter mapping scheme."}

我检查了我的 mailchimp api 密钥及其正确性。如果有人知道,请回复 下面是我的代码

    $apikey = 'api_key';

$to_emails = array('rohith038@gmail.com');
$to_names = array('You', 'Your Mom');

$message = array(
    'html'=>'Yo, this is the <b>html</b> portion',
    'text'=>'Yo, this is the *text* portion',
    'subject'=>'This is the subject',
    'from_name'=>'Me!',
    'from_email'=>'verifed@example.com',
    'to_email'=>$to_emails,
    'to_name'=>$to_names
);

$tags = array('WelcomeEmail');

$params = array(
    'apikey'=>$apikey,
    'message'=>$message,
    'track_opens'=>true,
    'track_clicks'=>false,
    'tags'=>$tags
);

$url = "http://us1.sts.mailchimp.com/1.0/SendEmail";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url.'?'.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$result = curl_exec($ch);
echo $result;
curl_close ($ch);

$data = json_decode($result);
echo "Status = ".$data->status."\n";

【问题讨论】:

  • 只是一个问题:“既然可以自己使用 php 发送,为什么还要使用 mailchimp 发送?”

标签: php api mailchimp


【解决方案1】:

如果不做更多研究,我会尝试将 $url 更改为 http://us5.sts.mailchimp.com/1.0/SendEmail,因为您的 API 密钥以 -us5 结尾,并且它抱怨您访问了错误的数据中心。

【讨论】:

  • 感谢 sblom,我更改了它,但之后出现此错误{"aws_type":null,"aws_code":null,"http_code":500,"message":"请先设置集成" }是否有任何其他集成设置
猜你喜欢
  • 2016-08-03
  • 2016-08-01
  • 2015-08-26
  • 2015-07-13
  • 1970-01-01
  • 2012-11-15
  • 2020-01-09
  • 1970-01-01
  • 2013-01-19
相关资源
最近更新 更多