MailGet provides API to integrate your website’s signup form with your MailGet account. You can download the MailGet API here.

Once you integrate MailGet API with your application, whenever any visitor signups at your website their contact information will automatically sync with your desired MailGet account contact list.


Integrate MailGet API with your Signup form by following these steps –

Step: 1   Click on the Settings tab in your MailGet dashboard. Now click on MailGet API button present under Integrations section.

Step: 2   In this page, you will find your Unique MailGet API Key. This MailGet API key is to be used on the signup page. Now click on Download MailGet API button to download MailGet API files.

MailGet-API

Step: 3  Now include or require mailget_curl.php file on your signup page code and write your MailGet API KEY as shown in the image given below.

If you want to set autoresponder for this list, then you can pass single in $send_val variable.

This $send_val variable is used to identify the process of adding contacts to a list.

If $send_val = ‘single‘  this means to add one contact at a time even array contains multiple emails, and if $send_val = ‘multiple‘  this means can add multiple emails to contact list at once.

Step: 4   Write your desired list name in which contact information of user collected from the form will be saved.

Pass the Name, Email, Custom, Custom1, Custom2, Custom3,  Date and IP address of the user in the array as shown in the image given below.

Note – Custom, Custom1, Custom2, Custom3Date and IP address is optional, you can just leave it blank.

MailGet-API-step2


MailGet API Usage –

Here is also a short example that shows how you can use MailGet API on sign up page –

<?php

require_once('mailget_curl.php');

if (isset($_POST['submit'])) {
$name = isset($_POST['name']) ? $_POST['name'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$custom = isset($_POST['custom']) ? $_POST['custom'] : '';
$custom1 = isset($_POST['custom1']) ? $_POST['custom1'] : '';
$custom2 = isset($_POST['custom2']) ? $_POST['custom2'] : '';
$custom3 = isset($_POST['custom3']) ? $_POST['custom3'] : '';

$mailget_key = 'Your API Key';
$send_val = 'single';/** For sending autoresponder use $send_val='single' * */
$mailget_obj = new mailget_curl($mailget_key);
$list_arr = $mailget_obj->get_list_in_json($mailget_key);
$list_id = '';
if (!empty($list_arr)) {
foreach ($list_arr as $list_arr_row) {
if ($list_arr_row->list_name == 'List Name') {
$list_id = $list_arr_row->list_id;
}
}
$mailget_arr = array(array(
'name' => $name,
'email' => $email,
'custom' => $custom,
'custom1' => $custom1,
'custom2' => $custom2,
'custom3' => $custom3,
'get_date' => date("Y-m-d"),
'ip' => ''
)
);
if ($list_id != '') {
$curt_status = $mailget_obj->curl_data($mailget_arr, $list_id, $send_val);
print_r($curt_status);
}
}
}
?>

MailGet API to delete contacts –

You can also use MailGet API to delete a particular contact from your MailGet list.

For this, You have to pass Email Address to delete and the List Name where the email exists as mentioned in below image.

mailget_api_key_delete

Here is a short example that shows how you can use MailGet API on your website page for deleting contact from your MailGet list –



<?php
require_once('mailget_curl.php');
$mailget_key  = 'Your API Key';
$mailget_obj  = new mailget_curl($mailget_key);
$list_arr     = $mailget_obj->get_list_in_json($mailget_key);
$list_id      = '';

/* To remove email from list */

$email_id = 'abc@domain.com';
if(!empty($list_arr)){
foreach($list_arr as $list_arr_row){
if($list_arr_row->list_name=='List Name'){
$list_id = $list_arr_row->list_id;
}
}
if($list_id!=''){
$curl_status = $mailget_obj->delete_from_list($email_id, $list_id);
print_r($curl_status);
}
}
?>


Now everything is set.! You can also try MailGet subscription form where you just have to embed the html code of the form at your sign up page.