All Projects → symfony → Mailer

symfony / Mailer

Licence: mit
The Mailer component helps sending emails

Projects that are alternatives of or similar to Mailer

Yaml
The Yaml component loads and dumps YAML files.
Stars: ✭ 3,359 (+451.56%)
Mutual labels:  symfony, symfony-component
Cache
The Cache component provides an extended PSR-6 implementation for adding cache to your applications.
Stars: ✭ 3,606 (+492.12%)
Mutual labels:  symfony, symfony-component
Security Acl
Symfony Security ACL Component
Stars: ✭ 321 (-47.29%)
Mutual labels:  symfony, symfony-component
mail
Actively maintained fork of gomail. The best way to send emails in Go.
Stars: ✭ 376 (-38.26%)
Mutual labels:  email, mailer
Polyfill Ctype
This component provides a partial, native PHP implementation for the Ctype extension.
Stars: ✭ 3,774 (+519.7%)
Mutual labels:  symfony, symfony-component
Dotenv
Symfony Dotenv parses .env files to make environment variables stored in them accessible via getenv(), $_ENV, or $_SERVER.
Stars: ✭ 3,268 (+436.62%)
Mutual labels:  symfony, symfony-component
Dom Crawler
The DomCrawler component eases DOM navigation for HTML and XML documents.
Stars: ✭ 3,499 (+474.55%)
Mutual labels:  symfony, symfony-component
Asset
The Asset component manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files.
Stars: ✭ 2,771 (+355.01%)
Mutual labels:  symfony, symfony-component
Notifier
Sends notifications via one or more channels (email, SMS, ...).
Stars: ✭ 346 (-43.19%)
Mutual labels:  symfony, symfony-component
Dependency Injection
The DependencyInjection component allows you to standardize and centralize the way objects are constructed in your application.
Stars: ✭ 3,635 (+496.88%)
Mutual labels:  symfony, symfony-component
email
Aplus Framework Email Library
Stars: ✭ 127 (-79.15%)
Mutual labels:  email, mailer
Workflow
The Workflow component provides tools for managing a workflow or finite state machine.
Stars: ✭ 418 (-31.36%)
Mutual labels:  symfony, symfony-component
mailjet-mailer
Provides Mailjet integration for Symfony Mailer.
Stars: ✭ 24 (-96.06%)
Mutual labels:  mailer, symfony-component
Lock
Creates and manages locks, a mechanism to provide exclusive access to a shared resource.
Stars: ✭ 299 (-50.9%)
Mutual labels:  symfony, symfony-component
Options Resolver
The OptionsResolver component is array_replace() on steroids. It allows you to create an options system with required options, defaults, validation (type, value), normalization and more.
Stars: ✭ 2,723 (+347.13%)
Mutual labels:  symfony, symfony-component
Polyfill Php70
This component provides features unavailable in releases prior to PHP 7.0.
Stars: ✭ 3,270 (+436.95%)
Mutual labels:  symfony, symfony-component
Expression Language
The ExpressionLanguage component provides an engine that can compile and evaluate expressions.
Stars: ✭ 2,418 (+297.04%)
Mutual labels:  symfony, symfony-component
Browser Kit
The BrowserKit component simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically.
Stars: ✭ 2,563 (+320.85%)
Mutual labels:  symfony, symfony-component
Config
The Config component helps you find, load, combine, autofill and validate configuration values of any kind, whatever their source may be (YAML, XML, INI files, or for instance a database).
Stars: ✭ 3,671 (+502.79%)
Mutual labels:  symfony, symfony-component
Filesystem
The Filesystem component provides basic utilities for the filesystem.
Stars: ✭ 4,111 (+575.04%)
Mutual labels:  symfony, symfony-component

Mailer Component

The Mailer component helps sending emails.

Getting Started

$ composer require symfony/mailer
use Symfony\Component\Mailer\Transport;
use Symfony\Component\Mailer\Mailer;

$transport = Transport::fromDsn('smtp://localhost');
$mailer = new Mailer($transport);

$email = (new Email())
    ->from('[email protected]')
    ->to('[email protected]')
    //->cc('[email protected]')
    //->bcc('[email protected]')
    //->replyTo('[email protected]')
    //->priority(Email::PRIORITY_HIGH)
    ->subject('Time for Symfony Mailer!')
    ->text('Sending emails is fun again!')
    ->html('<p>See Twig integration for better HTML integration!</p>');

$mailer->send($email);

To enable the Twig integration of the Mailer, require symfony/twig-bridge and set up the BodyRenderer:

use Symfony\Bridge\Twig\Mime\BodyRenderer;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Mailer\EventListener\MessageListener;
use Twig\Environment as TwigEnvironment;

$twig = new TwigEnvironment(...);
$messageListener = new MessageListener(new BodyRenderer($twig));

$eventDispatcher = new EventDispatcher();
$eventDispatcher->addSubscriber($messageListener);

$mailer = new Mailer($transport, null, $eventDispatcher);

$email = (new TemplatedEmail())
    // ...
    ->htmlTemplate('emails/signup.html.twig')
    ->context([
        'expiration_date' => new \DateTime('+7 days'),
        'username' => 'foo',
    ])
;
$mailer->mail($email);

Resources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].