|Classes of Christian Vigh||ApiLayer API Encapsulation||README.MAILBOXLAYER.md||Download|
The MailboxLayer class encapsulates the MailboxLayer api from ApiLayer.
Using the MailboxLayer object is pretty simple. Just instantiate an object, define the required properties, and call one of the MailboxLayer public methods ; the following example will retrieve information from the firstname.lastname@example.org email address and print it :
which should give the following result :
See the INTERPRETING MAILBOXLAYER RESULTS paragraph later in this document for more information on the resulting data.
Note that the parameter of the GetEmail() method is optional ; if not specified, the contents of the Email property will be used. So the following code is equivalent :
You can find the documentation on the MailboxLayer API from ApiLayers here :
Once you have successfully created a new account using your email address and a password, you will be able to see your dashboard information here :
You will be able to the specify an access key different from the default one.
MAILBOXLAYER CLASS CONSTRUCTOR
The MailboxLayer class constructor has the following syntax :
The parameters are the following :
MAILBOXLAYER CLASS PROPERTIES
The following properties are defined :
email or Email (string)
Email address whose information is to be retrieved (or the last email address whose information has been retrieved).
format or Format (boolean)
Set to 1 if the json contents returned by the api should be "pretty-printed" (for debugging purposes only).
smtp_check or SmtpCheck (boolean)
When set to 1, the smtp MX entry is checked.
catch_all or CatchAll (boolean)
When set to 1, possibly all smtp servers having an MX entry for this email address are checked.
callback or Callback (string)
See the mailboxlayer documentation for more information on this parameter.
MAILBOXLAYER CLASS METHODS
The MailboxLayer class contains the following methods :
public function GetEmail ( $email = null )
Retrieves information about the specified email address.
If no email address is specified, then the contents of the Email property will be used instead.
public function GetEmails ( $emails )
Retrieves information about the emails specified in the $emails string array.
Note that the MailboxLayer API does not provide any means to perform batch requests. This feature is provided only for convenience by the MailboxLayer class, but you should keep in mind that a MailboxLayer API query is issued for each email address you specify.
INTERPRETING MAILBOXLAYER RESULTS
The results returned by the GetEmail and GetEmails methods are simply the standard json data returned by the corresponding MailboxLayer API.
The meaning of the returned object properties is described below ; this comes directly from the MailboxLayer API documentation, which I encourage you to read thoroughly :