Skip to content

urbanindo/yii2-mail-object

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yii2-mail-object

This wraps mail object that can be instantiated rather standalone.

Build Status

Usage

Create new mail object class using MailObject.

e.g.

class DummyMail extends MailObject
{
    protected function getSubject(): string
    {
        return 'Hello, World!';
    }

    protected function getContentParams(): array
    {
        return [
            'recipientName' => 'Jane Doe',
        ];
    }

    protected function getRecipient(): array
    {
        return [
            '[email protected]' => 'Jane Doe',
        ];
    }

}

Create html.php and text.php for HTML-formatted and plain text email respectively.

To send the object, simply.

$mail = new DummyMail();
$mail->send();

Testing

To run testing, execute

./vendor/bin/phing test