lcidral/mail2easy-pro

Client library for interfacing with the Mail2EasyPRO API.

dev-master 2017-11-20 12:37 UTC

This package is auto-updated.

Last update: 2020-07-21 10:56:12 UTC


README

Client library for interfacing with the Mail2EasyPRO API.

Note: This package is in development, use for your own risk. Needs improvements, refactory and rewrite Tests.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist lcidral/mail2easy-pro "dev-master"

or add

"lcidral/mail2easy-pro": "dev-master"

to the require section of your composer.json file.

Configuration

Export evironment variable with Mail2Easy User Credentials:

$ export MAIL2EASYPRO_CREDENTIALS='{"user":"your-mail2easypro-account@mailinator.com","password":"y0urp455w0rd","client_code":"999999"}'

To persist this, you need to add this line in the .bash_profile file inside your home directory.

And run composer install.

Usage

Once the extension is installed, simply use it in your code by:

Get contact list Code

$contactList = Mail2EasyPRO::create(getenv("MAIL2EASYPRO_CREDENTIALS"), ContactList::class);
$contactListCode = $contactList->getContactListCode("TESTS - Lista de Contatos - Email");

Add new Contact in Contact List

$contact = Mail2EasyPRO::create(getenv("MAIL2EASYPRO_CREDENTIALS"), Contact::class);
$response = $contact->add($contactListCode, "php-mail2easy@mailinator.com", "Fulano XPTO", "Mail2EasyPRO-0000");

Update list of values, adding Tag

$contactListCode = 61;
$contactCode = 4;

$fieldLovCode = $this->contactListOfValues->getFieldLovCode($contactListCode, $contactCode, "Yout TAG Name in Contact List");
$response = $this->contact->update($contactListCode, $contactCode, null, null, [
    "cmp4" => [
        $fieldLovCode
    ]
]);