globegroup/emaillabs-mailer

Emaillabs.pl mailer using symfony/mailer transport abstraction.

v1.0 2019-12-27 14:38 UTC

This package is auto-updated.

Last update: 2024-04-28 21:28:48 UTC


README

Features included:

  • Configuration based on Symfony DSN in .env files
  • Sending emails with EmailLabs REST API
  • All benefits from symfony/mailer

Installation

  1. symfony/mailer is required in version 4.4.*

  2. Execute command:

    composer require globegroup/emaillabs-mailer
    
  3. Add service declaration in services.yaml:

    GlobeGroup\EmailLabsMailer\Transport\EmailLabsTransportFactory:
        tags:
            - { name: mailer.transport_factory }
  4. In .env.local use the configuration listed below:

    ###> symfony/mailer ###
    EMAILLABS_APP_KEY=<YOUR_APP_KEY>
    EMAILLABS_SECRET=<YOUR_SECRET>
    EMAILLABS_SMTP_ACCOUNT=<YOUR_SMTP_ACCOUNT>
    MAILER_DSN=emaillabs+api://$EMAILLABS_APP_KEY:$EMAILLABS_SECRET@default?smtpAccount=$EMAILLABS_SMTP_ACCOUNT
    ###< symfony/mailer ###

LOCAL TESTING

  1. Clone repository into symfony/localVendor folder.
  2. Add into composer.json:
    "repositories": [
        {
            "type": "path",
            "url": "localVendor/globegroup-emaillabs-mailer"
        }
    ],
  3. Check if minimum-stability is set to dev.
  4. Proceed to Installation.

EmailLabs specific functions

Tags

Add X-MailTags header when creating new email message and separate tags by ; as in example code:

$email = new Email();
$email->getHeaders()->addTextHeader('X-MailTags', 'tag_1;tag_2');

License

This bundle is under the MIT license. See the complete LICENSE

TODO

Verify string length? For example subject in EmailLabs is max 128 chars. Add recipe which automatically add service declaration. Add recipe which automatically add .env custom configuration example.