awsm/lib-mail

Awesome mail functionality. Easy and clean mail creation and transportation.

1.0.0-beta-1 2020-05-13 10:15 UTC

This package is auto-updated.

Last update: 2024-04-23 19:54:44 UTC


README

Easy and clean mail creation and transportation.

Version 1.0.0-beta-1

This little library allows you to create email objects easy sent by a selected transporter (PHP mail function, WordPress, etc.).

Example

<?php

use AWSM\LibMail\Transporter\PhpMail;
use AWSM\LibMail\Mail;
use AWSM\LibMail\MailException;


$mail = new Mail();
$transporter = new PhpMail();

try {
    $mail->addToEmail( 'john.doe@dummy.com' );
    $mail->setFromName( 'Developer' );
    $mail->setFromEmail( 'developer@dummy.com' );
    $mail->setSubject( 'Read my mail!' );
    $mail->setContent( 'Hello John! Greetings from the developer!' );

    $transporter->setMail( $mail );
    $transporter->send();
} catch ( MailException $e ) {
    echo $e->getMessage();
}