flowmailer/symfony-flowmailer-mailer

Provides Flowmailer integration for Symfony Mailer

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:symfony-mailer-bridge

1.0.1 2022-06-13 07:05 UTC

This package is auto-updated.

Last update: 2024-05-16 08:59:16 UTC


README

Provides Flowmailer integration for Symfony Mailer.

Installation

composer require flowmailer/symfony-flowmailer-mailer

Configuration

Obtain credentials from Flowmailer credentials wizard

Add the obtained credentials to the MAILER_DSN in the env file:

MAILER_DSN=flowmailer://CLIENT_ID:CLIENT_SECRET@api.flowmailer.net?account_id=1234

When using in a symfony project, you'll need to tag the transport factory as a 'mailer.transport_factory'.

# config/services.yaml
services:
   # Other services

    Flowmailer\Symfony\Mailer\Transport\FlowmailerTransportFactory:
        parent: 'mailer.transport_factory.abstract'
        tags:
            - name: 'mailer.transport_factory'

Stand alone:

use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport;
use Flowmailer\Symfony\Mailer\Transport\FlowmailerTransportFactory;

$factory   = new FlowmailerTransportFactory();
$transport = new Transport([$factory]);
$mailer    = new Mailer($transport->fromString($dsnString));

$email = (new Email())
    ->from('example@example.com')
    ->to('example@example.com')
    ->subject('Test e-mail')
    ->text('This is the content of the email')
    ->html('<p>Test e-mail with inline image</p><img src="cid:inline-image">')
    ->attachFromPath('path/to/attachment.pdf')
    ->embedFromPath('path/to/inline-image.png', 'inline-image')
;

$mailer->send($email);