albertborsos/yii2-mailmaster

Yii2 wrapper class for MailMaster API

v0.0.1 2015-10-04 16:57 UTC

This package is auto-updated.

Last update: 2024-11-08 07:53:04 UTC


README

MailMaster API wrapper for Yii2 projects

How to config in your project

  'components' => [
    ...
    'mailmaster' => [
          'class' => 'albertborsos\mailmaster\MailMaster',
          'apiUser' => 'mailmaster-api-user-name',
          'apiKey' => 'mailmaster-api-password',
          'forms' => [
              'your-form-id' =>[
                  'formID' => 'mailmaster-form-id',
                  'listID' => 'mailmaster-list-id',
              ],
          ],
    ],
    ...
  ],
...

How to handle after form submit

  /** @var \albertborsos\mailmaster\MailMaster $mmc */
  $mmc = Yii::$app->mailmaster;
  $mm = $mmc->factory($this->_listID, $this->_formID);

  $response = $mm->subscribe([
      'email' => $this->email,
      'mssys_firstname' => $this->nameFirst,
      'mssys_lastname' => $this->nameLast,
  ]);