2017 © Pedro Peláez
 

library skeleton-email

Email infrastructure for skeleton

image

tigron/skeleton-email

Email infrastructure for skeleton

  • Monday, June 11, 2018
  • by tigron
  • Repository
  • 2 Watchers
  • 0 Stars
  • 240 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 8 % Grown

The README.md

skeleton-email

Description

This library contains the email functionality of Skeleton, (*1)

Installation

Installation via composer:, (*2)

composer require tigron/skeleton-email
composer require tigron/skeleton-template-twig

Howto

Set the path for emails, (*3)

\Skeleton\Email\Config::$email_path = $some_very_cool_directory;

The email path must have the following structure, (*4)

- media
    - sample_media_dir1
        - image1.png
        - image2.png
    - sample_media_dir2
        - image3.png
    - image4.png
- template
    - email_type1
        - html.twig
        - subject.twig
        - text.twig
    - email_type2
        - html.twig
        - subject.twig
        - text.twig

Each email type must have its own directory containing the following files: - html.twig => the HTML version of the email - subject.twig => The subject line of the email - text.twig => The text version of the email, (*5)

References to media in the mail content will be fetches from the media directory, (*6)

Create a new mail:, (*7)

$email = new \Skeleton\Email\Email('email_type1');
$email->set_sender('sender@example.com', 'Test sender');
$email->add_to('to@example.com' [, 'to name' ]);

/**
 * Optional: translate the mail with a defined Translation object
 */
$language = Skeleton\I18n\Language::get_by_id(2);
$application = 'email'; // Used to fetch the po file
$translation = Skeleton\I18n\Translation::get($language, $application);
$email->set_translation($translation);

/**
 * Optional: add different recipient types
 */
$email->add_cc('cc@example.com' [, 'cc name' ]);
$email->add_bcc('bcc@example.com' [, 'bcc name' ]);

/**
 * Optional: add reply-to recipient
 */
$email->add_reply_to('reply-to@example.com' [, 'reply-to name' ]);

/**
 * Optional: attach file(s)
 */
$email->add_attachment(\Skeleton\File\File::get_by_id(1234));
$email->add_attachment_file('/some_very_cool_path/filename.ext');

/**
 * Optional: Archive mailbox. Send a copy of every mail to a given mailbox
 */
\Skeleton\Email\Config::$archive_mailbox = 'my_archive@example.com';

/**
 * Optional: Transport type. Send email using smtp or sendmail (default: sendmail)
 * When smtp is used at least a host and port are required.
 * Optionally you can also define which encryption is needed (ssl or tls)
 * and if authentication is required (username, password).
 */
\Skeleton\Email\Config::$transport_type = 'smtp';
\Skeleton\Email\Config::$transport_smtp_config = [
    'host' => 'smtp.example.com',
    'port' => 25,
    'encryption' => 'ssl',
    'username' => 'foo',
    'password' => 'bar'
];

/**
 * Optional: Assign variables
 */
$email->assign('variable1', 'content1');

/**
 * Send email
 */
$email->send();

The Versions

11/06 2018

dev-master

9999999-dev

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

11/06 2018

v0.2.4

0.2.4.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

22/05 2018

v0.2.3

0.2.3.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

21/03 2018

v0.2.2

0.2.2.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

06/02 2018

v0.2.0

0.2.0.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

06/02 2018

v0.2.1

0.2.1.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

30/01 2018

v0.1.3

0.1.3.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

19/12 2017

v0.1.2

0.1.2.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

19/08 2016

0.1.1

0.1.1.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

17/02 2016

v0.1.0

0.1.0.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

04/01 2016

v0.0.2

0.0.2.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA

18/08 2015

v0.0.1

0.0.1.0

Email infrastructure for skeleton

  Sources   Download

MIT

The Requires

 

by Tigron BVBA