xxxxxxxxxx
// Sazid Hasan Milon
// www.shmilon.com
// IOS (Swift)
MailchimpSDK.initialize(token: apy-key)
var contact: Contact = Contact(emailAddress: "Insert Email Here")
MailchimpSDK.createOrUpdate(contact: contact) { result in
switch result {
case .success:
print("Successfully added or updated contact")
case .failure(let error):
print("Error: \(error.localizedDescription)")
}
}
// in Kotlin
val sdkKey = "apy-key"
val isDebugBuild = BuildConfig.DEBUG
val configuration = MailchimpSdkConfiguration.Builder(context, sdkKey)
.isDebugModeEnabled(isDebugBuild)
.isAutoTaggingEnabled(true)
.build()
val mailchimpSdk = Mailchimp.initialize(configuration)
xxxxxxxxxx
// mailchimp api endpoint
https://us6.api.mailchimp.com/3.0/
// replace 'us6' with the value you find at the end of your api key 'randomkey-value'
xxxxxxxxxx
<?php
$apiKey = "your api key found easily in your account";
$campaignId = "your campaign id, you need to create one. Use the playground to get the id";
$memberId = md5(strtolower("membermail"));
$dataCenter = substr($apiKey,strpos($apiKey,'-')+1);
$url = 'https://'. $dataCenter . '.api.mailchimp.com/3.0/campaigns/' . $campaignId .'/actions/test';
$jsonEmail = '{"test_emails":["the mail you want to send thing sat"],"send_type":"html"}';
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, 'apikey:'.$apiKey);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonEmail);
$result = curl_exec($ch);
curl_close($ch);
var_dump($result);
?>