gpt4 book ai didi

php - 如何通过 MailChimp 3.0 api 发送电子邮件?

转载 作者:可可西里 更新时间:2023-10-31 22:48:18 25 4
gpt4 key购买 nike

我正在尝试通过 php 中的 mailchimp api 版本 3.0 发送电子邮件,但我没有运气。这是我的代码:

$postString = '{
"message": {
"html": "this is the emails html content",
"text": "this is the emails text content",
"subject": "this is the subject",
"from_email": "xxx@dyyy.sk",
"from_name": "John",
"to_email": "aaa.bbb@gmail.com",
"to_name": "Anton",
"track_opens": false,
"track_clicks": false
}}';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->api_endpoint);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, 'drewm:'.$this->api_key);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/vnd.api+json', 'Content-Type: application/vnd.api+json'));
curl_setopt($ch, CURLOPT_USERAGENT, 'DrewM/MailChimp-API/3.0 (github.com/drewm/mailchimp-api)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true );
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->verify_ssl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postString);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);

$result = curl_exec($ch);

echo $result;

我做错了什么?

最佳答案

您不能像使用 v1 那样从 API v3 发送随机电子邮件。现在您只能按照 LamaDelRay 的说明在 MailChimp 中发送之前创建的事件。

关于php - 如何通过 MailChimp 3.0 api 发送电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31718660/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com