From 46f8b0bc6265744797a2f399c820061f330f3a0e Mon Sep 17 00:00:00 2001 From: Dipen Baskaran Date: Sat, 28 Jun 2014 10:22:25 +0530 Subject: [PATCH] Create sendingNewsletter.php --- PHPwrapper/sendingNewsletter.php | 64 ++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 PHPwrapper/sendingNewsletter.php diff --git a/PHPwrapper/sendingNewsletter.php b/PHPwrapper/sendingNewsletter.php new file mode 100644 index 0000000..296468b --- /dev/null +++ b/PHPwrapper/sendingNewsletter.php @@ -0,0 +1,64 @@ +get_campaigns( +$api_key, +array ( + # find by name literally + 'name' => array ( 'EQUALS' => '' ) +) + ); + +# uncomment following line to preview Response +print_r($campaigns); + +# because there can be only one campaign of this name +# first key is the CAMPAIGN_ID required by next method +# (this ID is constant and should be cached for future use) + +$CAMPAIGN_ID = array_pop(array_keys($campaigns)); + +$contact_id = array('p3WW','PEU'); // Find the contact ID by using email ID and form as array like this. + + $body = "Newsletter message. we can send any HTML"; + + # Sending Newsletter to the campaign + $result = $client->send_newsletter( +$api_key, +array ( + + + "campaign" => $CAMPAIGN_ID, + "from_field" => "", // To find it . Use this $accountDetails = $api->getAccountFromFields(); + "reply_to_field" => "", // To find it . Use this $accountDetails = $api->getAccountFromFields(); + "subject" => "Subject of the Newsletter", + "name" =>"Any Name", + "contacts" => $contact_id, + +'contents' => array( + 'html' => $body + ) + ) + + ); + + + + + ?>