Rejects


rejectsAdd

Adds an email to your email rejection blacklist. No messages will be sent to this email; error will be returned with status rejected.

 

Description
bool rejectsAdd ( array $request )

 

Parameters
$request
array

Information about the rejection email to send.

email *
string

An email address to block.

comment
string

An optional comment describing the rejection.

 

Return value
bool

Returns TRUE if email added successfully to rejection blacklist, FALSE otherwise.

 

Examples

<?php
include_once('Leadersend.class.php');
$apikey 'YOUR_API_KEY'// specify your key
$LS = new Leadersend($apikey);

$request = array(
    
'email' => 'bad@example.com'// required
    
'comment' => 'Bad email'// optional
);
$ok $LS->rejectsAdd($request);
if (
$ok){
    echo 
"Email address rejected successfully.";
} else {
    
printf("Error (%s): %s"$LS->errorCode$LS->errorMessage);
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Reflection;
using System.Reflection.Emit;
using System.IO;

using Leadersend;
using Leadersend.ErrorHandling;
using Leadersend.DataObject;

namespace LeadersendTest
{
    class Test
    {
        private string apikey;
        public Wrapper api;

        public Test(string apikey)
        {
            this.apikey = apikey;
            this.api = new Wrapper(this.apikey);
        }

        public void rejects_add()
        {
            var request = new Dictionary<string, string>()
            {
                {"email", "example@example.com"}, //required
                {"comment", "Test"} //optional
            };

            bool resp = this.api.rejectsAdd(request);
            Console.WriteLine("Returned:\n" + Convert.ToString(resp));
        }

        static void Main(string[] args)
        {
            try
            {
                Test t = new Test("<API_KEY>");
                t.rejects_add();

            }
            catch (LeadersendException e)
            {
                Console.WriteLine("error message: " + e.Message);
                Console.WriteLine("error code: " + e.ErrorCode);
            }
            Console.WriteLine("\nFinished.\n");
        }
    }
}

 

Error Codes
Method-specific Errors
30 Invalid email address.
31 Specified email address looks fake or is invalid. You must provide a real email address.
105 Provided API key is invalid.
 
Global API Call Errors
10 You must specify value for the parameter reported in actual error message.
11 Invalid parameter type.
12 Parameter reported in actual message is required.
 
System General Errors
-1 System temporary is unavailable.
-2 Requested API method is not supported.
-3 Unknown error.
-98 We are running system maintenance.

 


rejectsDelete

Deletes an email from rejection blacklist. For example, if email is bounced  or unsubscribed, email is added to rejection blacklist. With this function you can remove email from rejection blacklist.

 

Description
array rejectsDelete ( array $request )

 

Parameters
$request
array

Information about the rejection email to send.

email *
string

An email address to remove from rejection blacklist.

 

Return value
bool

Returns TRUE if email removed successfully from rejection blacklist, FALSE otherwise.

 

Examples

<?php

include_once('Leadersend.class.php');
$apikey 'YOUR_API_KEY'// specify your key
$LS = new Leadersend($apikey);

$request = array(
    
'email' => 'bad@example.com' // required
);
$ok $LS->rejectsDelete($request);
if (
$ok){
    echo 
"Email address removed from rejection blacklist successfully.";
} else {
    
printf("Error (%s): %s"$LS->errorCode$LS->errorMessage);
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Reflection;
using System.Reflection.Emit;
using System.IO;

using Leadersend;
using Leadersend.ErrorHandling;
using Leadersend.DataObject;

namespace LeadersendTest
{
    class Test
    {
        private string apikey;
        public Wrapper api;

        public Test(string apikey)
        {
            this.apikey = apikey;
            this.api = new Wrapper(this.apikey);
        }

        public void rejects_delete()
        {
            var request = new Dictionary<string, string>()
            {
                {"email", "example@example.com"} //required
            };

            bool resp = this.api.rejectsDelete(request);
            Console.WriteLine("Returned:\n" + Convert.ToString(resp));
        }

        static void Main(string[] args)
        {
            try
            {
                Test t = new Test("<API_KEY>");
                t.rejects_delete();

            }
            catch (LeadersendException e)
            {
                Console.WriteLine("error message: " + e.Message);
                Console.WriteLine("error code: " + e.ErrorCode);
            }
            Console.WriteLine("\nFinished.\n");
        }
    }
}

 

Error Codes
Method-specific Errors
30 Invalid email address.
31 Specified email address looks fake or is invalid. You must provide a real email address.
105 Provided API key is invalid.
 
Global API Call Errors
10 You must specify value for the parameter reported in actual error message.
11 Invalid parameter type.
12 Parameter reported in actual message is required.
 
System General Errors
-1 System temporary is unavailable.
-2 Requested API method is not supported.
-3 Unknown error.
-98 We are running system maintenance.

 


rejectsList

Retrieves your email rejection blacklist. By default, entries that have expired are excluded from the results; set include_expired  to true to include them.

 

Description
array rejectsList ( array $request )

 

Parameters
$request
array

Additional filters for rejected emails list.

email
string

An optional email address to search by.

include_expired
boolean

Whether to include rejections that have already expired.

 

Return value
array

Email rejection blacklist.

return[]
struct

The information for each rejected email.

email
string

The email that is blocked.

reason
string

The type of event (custom, hard bounce, unsubscribe) that caused this rejection.

detail
string

Extended details about the event, such as the SMTP diagnostic for bounces or the comment for manually-created rejections.

created_at
datetime

When the email was added to the blacklist.

last_event_at
datetime

Date and time of the most recent event that either created or renewed this rejection.

expires_at
datetime

When the rejected email will expire (this may be in the past).

expired
boolean

Whether the rejected email has expired.

sender
struct

The sender that this rejected email applies to, or null if none (email added to the rejection blacklist manually).

address
string

The sender's email address.

created_at
datetime

The date and time that the sender was added to the LeaderSend.

sent
integer

The total number of messages sent by this sender.

hard_bounces
integer

The total number of hard bounces by messages by this sender.

soft_bounces
integer

The total number of soft bounces by messages by this sender.

blocked_bounces
integer

The total number of blocked bounces by messages by this sender.

complaints
integer

The total number of spam complaints received for messages by this sender.

rejects
integer

The total number of rejected messages by this sender.

unsubscribes
integer

The total number of unsubscribe requests received for messages by this sender.

opens
integer

The total number of times messages by this sender have been opened.

clicks
integer

The total number of times tracked URLs in messages by this sender have been clicked.

unique_opens
integer

The number of unique opens for emails sent for this sender.

unique_clicks
integer

The number of unique clicks for emails sent for this sender.

 

Examples

<?php
include_once('Leadersend.class.php');
$apikey 'YOUR_API_KEY'// specify your key
$LS = new Leadersend($apikey);

$request = array(
    
'email' => 'bad@example.com'// optional
    
'include_expired' => true // optional
);
$blacklist $LS->rejectsList($request);
header("Content-Type: text/plain");
if (
$LS->errorCode){
    
printf("Error (%s): %s"$LS->errorCode$LS->errorMessage);
} else {
    echo 
"Email rejection blacklist:\n";
    
print_r($blacklist);
    
/*
    Array
    (
        [0] => Array
        (
            [email] => bad@example.com
            [reason] => custom
            [detail] => Bad email
            [created_at] => 2014-05-09 12:14:06
            [last_event_at] => 2014-05-09 12:14:25
            [expires_at] => 2014-08-07 12:14:06
            [expired] => 
            [sender] => Array
            (
                [address] => 
                [created_at] => 2014-05-09 12:14:06
                [sent] => 0
                [hard_bounces] => 0
                [soft_bounces] => 0
                [blocked_bounces] => 0
                [complaints] => 0
                [rejects] => 0
                [unsubscribes] => 0
                [opens] => 0
                [clicks] => 0
                [unique_opens] => 0
                [unique_clicks] => 0
            )
        )
    )
    */
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Reflection;
using System.Reflection.Emit;
using System.IO;

using Leadersend;
using Leadersend.ErrorHandling;
using Leadersend.DataObject;

namespace LeadersendTest
{
    class Test
    {
        private string apikey;
        public Wrapper api;

        public Test(string apikey)
        {
            this.apikey = apikey;
            this.api = new Wrapper(this.apikey);
        }

        public void rejects_list()
        {
            var request = new Dictionary<string, string>()
            {
                //{"email", "example@example.com"}, //optional
                {"include_expired", Convert.ToString(true)} //optional
            };

            IEnumerable<LSRejectResponse> responses = this.api.rejectsList(request);
            Console.WriteLine("Success!");
            foreach (LSRejectResponse response in responses)
            {
                Console.WriteLine(response.email + " = " + response.reason);
                Console.WriteLine("\tdetail = " + response.detail);
                Console.WriteLine("\texpired = " + Convert.ToString(response.expired));
            }
        }

        static void Main(string[] args)
        {
            try
            {
                Test t = new Test("<API_KEY>");
                t.rejects_list();

            }
            catch (LeadersendException e)
            {
                Console.WriteLine("error message: " + e.Message);
                Console.WriteLine("error code: " + e.ErrorCode);
            }
            Console.WriteLine("\nFinished.\n");
        }
    }
}

 

Error Codes
Method-specific Errors
30 Invalid email address.
31 Specified email address looks fake or is invalid. You must provide a real email address.
105 Provided API key is invalid.
 
Global API Call Errors
10 You must specify value for the parameter reported in actual error message.
11 Invalid parameter type.
12 Parameter reported in actual message is required.
 
System General Errors
-1 System temporary is unavailable.
-2 Requested API method is not supported.
-3 Unknown error.
-98 We are running system maintenance.

 

* required parameters