2017 © Pedro Peláez
 

library lib-mail

Mail library of the Ride framework

image

ride/lib-mail

Mail library of the Ride framework

  • Thursday, October 13, 2016
  • by ride-user
  • Repository
  • 8 Watchers
  • 0 Stars
  • 3,535 Installations
  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 10 Versions
  • 2 % Grown

The README.md

Ride: Mail Library

Mail library of the PHP Ride framework., (*1)

What's In This Library

MailAddress

The MailAddress class is used to deal with email addresses. All recipients of a MailMessage are set with this class. It allows straight email addresses but also addresses in the format of name ., (*2)

MailMessage

The MailMessage class is a data container of the mail to send. You can set the recipients through the To, CC and BCC field. You can flag a message as an HTML message, add attachments and more., (*3)

MimePart

The MimePart class is internally used to add attachments to a MailMessage. You can use it manually to create a custom multipart message., (*4)

Transport

The Transport interface offers a way to implement the actual sending of a mail. It's also the starting point when you want to send a mail with this library as it also acts as a factory for messages., (*5)

A generic implentation is provided is this library through the SimpleTransport class. This uses the PHP functions to send a mail., (*6)

MessageParser

The MessageParser class is a helper for the Transport implementations. It takes a MailMessage and extracts all information into a structure which can be used by the transport., (*7)

Code Sample

Check the following code sample to some of the possibilities of this library., (*8)

<?php

use ride\library\log\Log;
use ride\library\mail\transport\SimpleTransport;
use ride\library\mail\transport\Transport;
use ride\library\system\file\FileSystem;

function createTransport(Log $log) {
    // simple, create an instance
    $transport = new SimpleTransport($log);

    // you set some defaults to you don't have to set this to each message
    $transport->setDefaultFrom('from@domain.com');
    $transport->setDefaultReplyTo('from@domain.com');

    // you can set a debug address 
    // no recipients in the To, CC and BCC will receive the message, only this debug to address
    $transport->setDebugTo('me@domain.com');

    return $transport;
}

function sendMail(MandrillTransport $transport, FileSystem $fileSystem) {
    $message = $transport->createMessage();
    $message->setSubject('My subject');
    $message->setRecipient('to@domain.com');
    $message->addCc('To 2 <to2@domain.com>');
    $message->addBcc(array('to3@domain.com', 'To 3 <to3@domain.com>'));
    $message->setIsHtmlMessage(true);
    $message->setMessage('<html><body>

..., (*9)

</body></html>'); $file = $fileSystem->getFile('/path/to/image.png'); $message->addAttachement($file, 'image/png'); try { $transport->send($message); } catch (MailException $exception) { } }

Installation

You can use Composer to install this library., (*10)

composer require ride/lib-mail

The Versions

13/10 2016

dev-master

9999999-dev

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

13/10 2016

dev-develop

dev-develop

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

13/10 2016

1.0.0

1.0.0.0

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

06/08 2016

0.5.1

0.5.1.0

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

26/04 2016

0.5.0

0.5.0.0

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

04/11 2015

0.4.3

0.4.3.0

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

04/11 2015

0.4.2

0.4.2.0

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

05/06 2015

0.4.1

0.4.1.0

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

03/06 2015

0.4.0

0.4.0.0

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd

28/05 2015

0.3.0

0.3.0.0

Mail library of the Ride framework

  Sources   Download

MIT

The Requires

 

by Joris Vandeweerd