https://<subdomain>.sendsmaily.net/api/unsubscribe.php


In addition to unsubscribing contact through subscriber update request (see chapter Update subscriber data), one can unsubscribe contact through specific campaign. This adds unsubscribe statistics to the specified campaign.


Request must be sent using POST method.

Request parameters

Value of each parameter must be URL encoded.


Parameter

Value

campaign_id

Unique identifier of the campaign, that is returned on campaign launch request or can be found from the results of campaigns list request. Required.

email

Subscriber’s email address. Required.


Example query:

Unsubscribing subscriber from a specific campaign

With this example request subscriber with email address tugi@smaily.com is unsubscribed from the campaign “Head pakkumised - 8. aprill 2014”.

   

$username = 'YOUR_USERNAME';
$password = 'YOUR_PASSWORD';
$loc = 'https://<subdomain>.sendsmaily.net/api/unsubscribe.php';
$query = 'email=tugi%40smaily.com&campaign_id=1';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $loc);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
curl_setopt($ch, CURLOPT_USERPWD, "$username:$password");

$result = curl_exec($ch);
curl_close($ch);

 

Successful results of the query are:

 

{
  'code': 101,
  'message': 'OK'
}

 

 See also other possible results from Possible results.