mailchimp-api
mailchimp-api copied to clipboard
Your Campaign is not ready to send
Hello,
I am trying to send and create a test campaign. and i am facing error
Array
(
[type] => http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/
[title] => Bad Request
[status] => 400
[detail] => Your Campaign is not ready to send.
[instance] => 7f4599dd-8e3b-4eff-91a6-92e3a627d599
)`
I have used following code
require_once('mc/MailChimp.php');
require_once('mc/Batch.php');
require_once('mc/Webhook.php');
use \DrewM\MailChimp\MailChimp;
$list_id='19029296bd';
$newsletter_subject_line ='Test Subject';
$reply_to = '[email protected]';
$from_name= 'News Lume';
define('MAILCHIMP_API_KEY', 'XXXXXXXXXXXXXXX-us16');
//$MailChimp = new MailChimp(MAILCHIMP_API_KEY);
//$result = $MailChimp->get('lists');
//var_dump($result);
$MailChimp = new MailChimp(MAILCHIMP_API_KEY);
// Create or Post new Campaign
$result = $MailChimp->post("campaigns/", [
'type' => 'regular',
'recipients' => ['list_id' => $list_id],
'settings' => ['subject_line' => $newsletter_subject_line,
'reply_to' => $reply_to,
'from_name' => $from_name,
'title' => 'DrewM Test',
'use_conversation'=> false,
'to_name'=> 'sajid',
'auto_footer'=> false,
'inline_css'=> false,
'auto_tweet'=> false,
'drag_and_drop'=> false,
'content_type'=>'template',
]
]);
$response = $MailChimp->getLastResponse();
$responseObj = json_decode($response['body']);
echo '<pre> <h1> Heading 1</h1>';
print_r($result);
print_r( $response);
// Manage Campaign Content
$html = '<div style="background:red; color:#fff; padding:50px">Hello World</div>';
$result = $MailChimp->put('campaigns/' . $responseObj->id . '/content', [
'template' => ['id' => 47615,
'sections' => ['body' => $html]
]
]);
$result = $MailChimp->post('campaigns/' . $responseObj->id . '/actions/send');
echo '<pre> <h1> Heading 2</h1>';
print_r($result);`
I have also verified and authenticated domain name for sending emails.
Probably you already resolved your issue, but my response could help someone else. I got the same error on several different occasions:
- When the template contained default blocks.
- When the FROM email in the campaign is not validated (https://kb.mailchimp.com/accounts/email-authentication/verify-a-domain)
- It fails when you try to create a list, add someone to the list, create campaign and try to send the campaign. It works though if your list was already created. The solution for me (although not very elegant) was to set a timeout for 4 minutes between campaign creation and campaign sending.
Is there a solution for this problem???
I get this error when:
- I create a list
- add someone to the list
- create campaign and try to send the campaign
BUT it works if the list was already created.
I has the Same issue even if the list was created already also. Can you please help me
We set timeout and waited for 60 seconds to send. It worked before until about March, what has changed or volumes were up too much to handle by Mail Chimp server?
I figured it out. You have to send-checklist before sending the campaign:
function send_checklist($campaign_id = null) { GLOBAL $MailChimp_MC; $result = $MailChimp_MC->get("campaigns/$campaign_id/send-checklist"); return $result; }
Thanks a lot this helped me a lot
On Thu, Jun 21, 2018 at 7:09 PM, vtrinhaxyz [email protected] wrote:
I figured it out. You have to send-checklist before sending the campaign:
function send_checklist($campaign_id = null) { GLOBAL $MailChimp_MC; $result = $MailChimp_MC->get("campaigns/$campaign_id/send-checklist"); return $result; }
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/drewm/mailchimp-api/issues/209#issuecomment-399106609, or mute the thread https://github.com/notifications/unsubscribe-auth/AayY1njmUPB-5cZAWvFOck76n-4KE6H1ks5t-6IGgaJpZM4PY8MK .
-- Vinay Odela.
Thanks.
Gents, the solution is really this: execute the checklist before to send the campaign.