0151 355 4555

IsMailable

Description

Checks if the person given in the input record is registered with the MPS, and so does not wish to receive marketing by direct mail. If they are willing to receive direct mail, the service returns true. If not, the service returns false.

View all Mailing Preference Service methods

Code Samples

<!-- Import the Integr8 Ajax API -->
<!-- NOTE: Get your own API key to use in the following script tag from: -->
<!-- http://www.data-8.co.uk/integr8/Admin/Ajax.aspx -->
<script src="https://webservices.data-8.co.uk/Javascript/Loader.ashx?key=your-api-key" type="text/javascript">
</script>

<script type="text/javascript">

function loadIntegr8() {
  // Load the MPS Integr8 service
  data8.load('MPS');
}

function IsMailable(record) {
  /// <param name="record">data8.inputrecord. Set up the Name, Address properties before calling this method.</param>
  var mps = new data8.mps();
  
  mps.ismailable(
    record,
    null,
    showIsMailableResult
  );
}

function showIsMailableResult(result) {
  // Check that the call succeeded, and show the error message if there was a problem.
  if (!result.Status.Success) {
    alert('Error: ' + result.Status.ErrorMessage);
  }
  else {
    // TODO: Process method results here.
    // Results can be extracted from the following fields:
    // result.Mailable
    //   Indicates if the person has been found to be on the MPS.
  }
}

loadIntegr8();

</script>