GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - charcoalphp/email: [READ-ONLY] Charcoal email sending (with phpmailer) and queue management.

BranchesTags
Open more actions menu

Latest commit

 

History

173 Commits
173 Commits

Folders and files

NameName
Last commit message
Last commit date
database/migration/Charcoal/Email
database/migration/Charcoal/Email
 
 
metadata
metadata
 
 
src/Charcoal/Email
src/Charcoal/Email
 
 
tests
tests
 
 
translations
translations
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpcs.xml.dist
phpcs.xml.dist
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 

Repository files navigation

Charcoal Email

The Email package provides an integration with PHPMailer for sending emails.

Installation

composer require charcoal/email

For Charcoal projects, the service provider can be registered from your configuration file:

{
    "service_providers": {
        "charcoal/email/service-provider/email": {}
    }
}

Usage

use Charcoal\Email\ServiceProvider\EmailServiceProvider;
use Pimple\Container;

$container = new Container();
$container->register(new EmailServiceProvider());

$email = $container['email'];
$email->setData([
    'from' => '"Company inc." <[email protected]>',
    'bcc'  => '[email protected]',
    'to'   => [
        '[email protected]',
        '"Some guy" <[email protected]>',
        [
            'name'  => 'Other guy',
            'email' => '[email protected]',
        ],
    ],
    'reply_to' => [
        'name'  => 'Jack CEO',
        'email' => '[email protected]'
    ],
    'subject'        => $this->translator->trans('Email subject'),
    'campaign'       => 'Campaign identifier',
    'template_ident' => 'foo/email/default-email'
    'attachments'    => [
        'foo/bar.pdf',
        'foo/baz.pdf',
    ],
]);

// Dispatch immediately:
$email->send();

// Alternately, dispatch at a later date using the queue system:
$email->queue('in 5 minutes');

Email Config

The entire email system can be configured from the main app config, in the email config key.

{
    "email": {
        "smtp": true,
        "smtp_hostname": "smtp.example.com",
        "smtp_port": 25,
        "smtp_security": "tls",
        "smtp_username": "[email protected]",
        "smtp_password": "password",

        "default_from": "[email protected]",
        "default_reply_to": "[email protected]",
        "default_track": false,
        "default_log": true
    }
}

Service Provider

All email services can be quickly registered to a service container with \Charcoal\Email\ServiceProvider\EmailServiceProvider.

Provided services:

Service Type Description
email Email[1] An email object (factory).
email/factory FactoryInterface[2] An email factory, to create email objects.

Notes:

  • [1] \Charcoal\Email\Email.
  • [2] Charcoal\Factory\FactoryInterface.

Also available are the following helpers:

Helper Service Type Description
email/config EmailConfig[3] Email configuration.
email/view ViewInterface[4] The view object to render email templates ($container['view']).

Notes:

  • [3] \Charcoal\Email\EmailConfig.
  • [4] \Charcoal\View\ViewInterface.

Resources

  • Contributing
  • Report issues and send pull requests in the main Charcoal repository

About

[READ-ONLY] Charcoal email sending (with phpmailer) and queue management.

github.com/charcoalphp/charcoal

Topics

emailemail-senderphpphpmailerqueueread-only-repository

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

0 stars

Watchers

2 watching

Forks

0 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.