Mailchimp API (PHP) - Your Campaign is not ready to send
I am having a problem usign the Mailchimp API with PHP.
When I'm running the code, this is the error I get:
{
"type": "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title": "Bad Request",
"status": 400,
"detail": "Your Campaign is not ready to send.",
"instance": "46235d29-6a67-4d55-800d-a95e2dc7273f"
}
I know why the campaign is not ready to send, as you can see in this image, the details are filled, but not saved:
Here is the code I'm trying to run:
<?php
require '../vendor/autoload.php';
$apiKey = 'API ';
$mailchimp = new MailchimpAPIMailchimp($apiKey);
$list_created = $mailchimp->lists()->post([
'name' => 'Lista Monday',
'contact' => [
'company' => 'Test Company Monday',
'address1' => 'Monday address 1',
'city' => 'Monday City',
'state' => 'Monday State',
'zip' => '227560',
'country' => 'Romania'
],
'permission_reminder' => 'test',
'campaign_defaults' => [
'from_name' => 'Anjus Parsay',
'from_email' => 'FROM EMAIL',
'subject' => 'Monday Email',
'language' => 'English'
],
'email_type_option' => false
]);
$list_id = json_decode($list_created->getBody(), true)['id'];
$email = "EMAIL ";
$addedUser = $mailchimp->lists($list_id)->members()->post([
'email_address' => $email,
'status' => 'subscribed'
]);
//1. Create the template
$template_content = file_get_contents("http://widevisiondesign.com/anjus/mailchimp/src/testTemplate.html");
$template = $mailchimp->templates()->post([
'name' => 'testTemplateHTML',
'html' => $template_content
]);
$template_id = json_decode($template->getBody(), true)['id'];
//2. Create a campaign
$campaign = $mailchimp->campaigns()->post([
'type' => 'regular',
'recipients' => [
'list_id' => $list_id
],
'settings' => [
'title' => 'Monday',
'subject_line' => 'Monday - Sunday',
'from_name' => 'NAME NAME',
'to_name' => 'test',
'preview_text' => 'Preview text - Monday',
'template_id' => $template_id
]
]);
$campaign_id = json_decode($campaign->getBody(), true)['id'];
$sent = $mailchimp->campaigns($campaign_id)->send([$email], 'plaintext')->getBody();
print_r($sent);
?>
Thank you!
php mailchimp mailchimp-api-v3.0
add a comment |
I am having a problem usign the Mailchimp API with PHP.
When I'm running the code, this is the error I get:
{
"type": "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title": "Bad Request",
"status": 400,
"detail": "Your Campaign is not ready to send.",
"instance": "46235d29-6a67-4d55-800d-a95e2dc7273f"
}
I know why the campaign is not ready to send, as you can see in this image, the details are filled, but not saved:
Here is the code I'm trying to run:
<?php
require '../vendor/autoload.php';
$apiKey = 'API ';
$mailchimp = new MailchimpAPIMailchimp($apiKey);
$list_created = $mailchimp->lists()->post([
'name' => 'Lista Monday',
'contact' => [
'company' => 'Test Company Monday',
'address1' => 'Monday address 1',
'city' => 'Monday City',
'state' => 'Monday State',
'zip' => '227560',
'country' => 'Romania'
],
'permission_reminder' => 'test',
'campaign_defaults' => [
'from_name' => 'Anjus Parsay',
'from_email' => 'FROM EMAIL',
'subject' => 'Monday Email',
'language' => 'English'
],
'email_type_option' => false
]);
$list_id = json_decode($list_created->getBody(), true)['id'];
$email = "EMAIL ";
$addedUser = $mailchimp->lists($list_id)->members()->post([
'email_address' => $email,
'status' => 'subscribed'
]);
//1. Create the template
$template_content = file_get_contents("http://widevisiondesign.com/anjus/mailchimp/src/testTemplate.html");
$template = $mailchimp->templates()->post([
'name' => 'testTemplateHTML',
'html' => $template_content
]);
$template_id = json_decode($template->getBody(), true)['id'];
//2. Create a campaign
$campaign = $mailchimp->campaigns()->post([
'type' => 'regular',
'recipients' => [
'list_id' => $list_id
],
'settings' => [
'title' => 'Monday',
'subject_line' => 'Monday - Sunday',
'from_name' => 'NAME NAME',
'to_name' => 'test',
'preview_text' => 'Preview text - Monday',
'template_id' => $template_id
]
]);
$campaign_id = json_decode($campaign->getBody(), true)['id'];
$sent = $mailchimp->campaigns($campaign_id)->send([$email], 'plaintext')->getBody();
print_r($sent);
?>
Thank you!
php mailchimp mailchimp-api-v3.0
Checkout the answer to this SO question
– Diddle Dot
Nov 19 '18 at 15:23
I already checked this post. No luck.
– Alexandru
Nov 19 '18 at 15:53
add a comment |
I am having a problem usign the Mailchimp API with PHP.
When I'm running the code, this is the error I get:
{
"type": "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title": "Bad Request",
"status": 400,
"detail": "Your Campaign is not ready to send.",
"instance": "46235d29-6a67-4d55-800d-a95e2dc7273f"
}
I know why the campaign is not ready to send, as you can see in this image, the details are filled, but not saved:
Here is the code I'm trying to run:
<?php
require '../vendor/autoload.php';
$apiKey = 'API ';
$mailchimp = new MailchimpAPIMailchimp($apiKey);
$list_created = $mailchimp->lists()->post([
'name' => 'Lista Monday',
'contact' => [
'company' => 'Test Company Monday',
'address1' => 'Monday address 1',
'city' => 'Monday City',
'state' => 'Monday State',
'zip' => '227560',
'country' => 'Romania'
],
'permission_reminder' => 'test',
'campaign_defaults' => [
'from_name' => 'Anjus Parsay',
'from_email' => 'FROM EMAIL',
'subject' => 'Monday Email',
'language' => 'English'
],
'email_type_option' => false
]);
$list_id = json_decode($list_created->getBody(), true)['id'];
$email = "EMAIL ";
$addedUser = $mailchimp->lists($list_id)->members()->post([
'email_address' => $email,
'status' => 'subscribed'
]);
//1. Create the template
$template_content = file_get_contents("http://widevisiondesign.com/anjus/mailchimp/src/testTemplate.html");
$template = $mailchimp->templates()->post([
'name' => 'testTemplateHTML',
'html' => $template_content
]);
$template_id = json_decode($template->getBody(), true)['id'];
//2. Create a campaign
$campaign = $mailchimp->campaigns()->post([
'type' => 'regular',
'recipients' => [
'list_id' => $list_id
],
'settings' => [
'title' => 'Monday',
'subject_line' => 'Monday - Sunday',
'from_name' => 'NAME NAME',
'to_name' => 'test',
'preview_text' => 'Preview text - Monday',
'template_id' => $template_id
]
]);
$campaign_id = json_decode($campaign->getBody(), true)['id'];
$sent = $mailchimp->campaigns($campaign_id)->send([$email], 'plaintext')->getBody();
print_r($sent);
?>
Thank you!
php mailchimp mailchimp-api-v3.0
I am having a problem usign the Mailchimp API with PHP.
When I'm running the code, this is the error I get:
{
"type": "http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/",
"title": "Bad Request",
"status": 400,
"detail": "Your Campaign is not ready to send.",
"instance": "46235d29-6a67-4d55-800d-a95e2dc7273f"
}
I know why the campaign is not ready to send, as you can see in this image, the details are filled, but not saved:
Here is the code I'm trying to run:
<?php
require '../vendor/autoload.php';
$apiKey = 'API ';
$mailchimp = new MailchimpAPIMailchimp($apiKey);
$list_created = $mailchimp->lists()->post([
'name' => 'Lista Monday',
'contact' => [
'company' => 'Test Company Monday',
'address1' => 'Monday address 1',
'city' => 'Monday City',
'state' => 'Monday State',
'zip' => '227560',
'country' => 'Romania'
],
'permission_reminder' => 'test',
'campaign_defaults' => [
'from_name' => 'Anjus Parsay',
'from_email' => 'FROM EMAIL',
'subject' => 'Monday Email',
'language' => 'English'
],
'email_type_option' => false
]);
$list_id = json_decode($list_created->getBody(), true)['id'];
$email = "EMAIL ";
$addedUser = $mailchimp->lists($list_id)->members()->post([
'email_address' => $email,
'status' => 'subscribed'
]);
//1. Create the template
$template_content = file_get_contents("http://widevisiondesign.com/anjus/mailchimp/src/testTemplate.html");
$template = $mailchimp->templates()->post([
'name' => 'testTemplateHTML',
'html' => $template_content
]);
$template_id = json_decode($template->getBody(), true)['id'];
//2. Create a campaign
$campaign = $mailchimp->campaigns()->post([
'type' => 'regular',
'recipients' => [
'list_id' => $list_id
],
'settings' => [
'title' => 'Monday',
'subject_line' => 'Monday - Sunday',
'from_name' => 'NAME NAME',
'to_name' => 'test',
'preview_text' => 'Preview text - Monday',
'template_id' => $template_id
]
]);
$campaign_id = json_decode($campaign->getBody(), true)['id'];
$sent = $mailchimp->campaigns($campaign_id)->send([$email], 'plaintext')->getBody();
print_r($sent);
?>
Thank you!
php mailchimp mailchimp-api-v3.0
php mailchimp mailchimp-api-v3.0
edited Nov 19 '18 at 14:33
Álvaro González
106k30187276
106k30187276
asked Nov 19 '18 at 14:23
AlexandruAlexandru
43
43
Checkout the answer to this SO question
– Diddle Dot
Nov 19 '18 at 15:23
I already checked this post. No luck.
– Alexandru
Nov 19 '18 at 15:53
add a comment |
Checkout the answer to this SO question
– Diddle Dot
Nov 19 '18 at 15:23
I already checked this post. No luck.
– Alexandru
Nov 19 '18 at 15:53
Checkout the answer to this SO question
– Diddle Dot
Nov 19 '18 at 15:23
Checkout the answer to this SO question
– Diddle Dot
Nov 19 '18 at 15:23
I already checked this post. No luck.
– Alexandru
Nov 19 '18 at 15:53
I already checked this post. No luck.
– Alexandru
Nov 19 '18 at 15:53
add a comment |
1 Answer
1
active
oldest
votes
From the code and screenshot you presented, here are some things that came to my mind:
- Have you verified and authenticated your email address? If no, you need to authenticate the domain of your email address. Go to your Mailchimp dashboard, click Account > Settings > Domains > Verify a Domain.
- Then add your domain, follow the instruction to verify and authenticate.
- If you prefer, you can make an API call to get a checklist before actually sending the email. The checklist gives a success and error notes on what needs to be done before actually sending the email.
- I'm sorry if this seems somehow but did you really provide your email address in place of the 'FROM EMAIL' placeholder? From the code, it seems that you set the name of the from_name but did not set the from_email.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376656%2fmailchimp-api-php-your-campaign-is-not-ready-to-send%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
From the code and screenshot you presented, here are some things that came to my mind:
- Have you verified and authenticated your email address? If no, you need to authenticate the domain of your email address. Go to your Mailchimp dashboard, click Account > Settings > Domains > Verify a Domain.
- Then add your domain, follow the instruction to verify and authenticate.
- If you prefer, you can make an API call to get a checklist before actually sending the email. The checklist gives a success and error notes on what needs to be done before actually sending the email.
- I'm sorry if this seems somehow but did you really provide your email address in place of the 'FROM EMAIL' placeholder? From the code, it seems that you set the name of the from_name but did not set the from_email.
add a comment |
From the code and screenshot you presented, here are some things that came to my mind:
- Have you verified and authenticated your email address? If no, you need to authenticate the domain of your email address. Go to your Mailchimp dashboard, click Account > Settings > Domains > Verify a Domain.
- Then add your domain, follow the instruction to verify and authenticate.
- If you prefer, you can make an API call to get a checklist before actually sending the email. The checklist gives a success and error notes on what needs to be done before actually sending the email.
- I'm sorry if this seems somehow but did you really provide your email address in place of the 'FROM EMAIL' placeholder? From the code, it seems that you set the name of the from_name but did not set the from_email.
add a comment |
From the code and screenshot you presented, here are some things that came to my mind:
- Have you verified and authenticated your email address? If no, you need to authenticate the domain of your email address. Go to your Mailchimp dashboard, click Account > Settings > Domains > Verify a Domain.
- Then add your domain, follow the instruction to verify and authenticate.
- If you prefer, you can make an API call to get a checklist before actually sending the email. The checklist gives a success and error notes on what needs to be done before actually sending the email.
- I'm sorry if this seems somehow but did you really provide your email address in place of the 'FROM EMAIL' placeholder? From the code, it seems that you set the name of the from_name but did not set the from_email.
From the code and screenshot you presented, here are some things that came to my mind:
- Have you verified and authenticated your email address? If no, you need to authenticate the domain of your email address. Go to your Mailchimp dashboard, click Account > Settings > Domains > Verify a Domain.
- Then add your domain, follow the instruction to verify and authenticate.
- If you prefer, you can make an API call to get a checklist before actually sending the email. The checklist gives a success and error notes on what needs to be done before actually sending the email.
- I'm sorry if this seems somehow but did you really provide your email address in place of the 'FROM EMAIL' placeholder? From the code, it seems that you set the name of the from_name but did not set the from_email.
edited Dec 20 '18 at 5:21
answered Dec 20 '18 at 4:59
francfranc
1578
1578
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376656%2fmailchimp-api-php-your-campaign-is-not-ready-to-send%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Checkout the answer to this SO question
– Diddle Dot
Nov 19 '18 at 15:23
I already checked this post. No luck.
– Alexandru
Nov 19 '18 at 15:53