PHP code example of ideneal / emailoctopus

1. Go to this page and download the library: Download ideneal/emailoctopus library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ideneal / emailoctopus example snippets


use Ideneal\EmailOctopus\EmailOctopus;

$emailOctopus = new EmailOctopus('YOUR-API-KEY');

use Ideneal\EmailOctopus\Entity\MailingList;

$list = new MailingList();
$list->setName('My cool list');

$emailOctopus->createMailingList($list);

use Ideneal\EmailOctopus\Entity\Contact;

$contact = new Contact();
$contact
    ->setEmail('[email protected]')
    ->setFirstName('John')
    ->setLastName('Doe')
;

$emailOctopus->createContact($contact, $list);

$emailOctopus->getContactsByMailingList($list);

$contact = $emailOctopus->getContactByMailingList('CONTACT-ID', $list);
$emailOctopus->deleteContact($contact, $list);