oliveris/sdk-mail

Sends email and campaigns to a provider specified.


Keywords
mail, email, laravel, mailgun
License
MIT

Documentation

Mail SDK

PHP-SDK for multiple Mail services

Pupose of the SDK is to help with the delivery of mail and campaigns using multiple services.

Usage

Pull in the composer package by running the command below:

composer require oliveris/sdk-mail

Import the Mail namespace into the class (autoloading)

use Mail\Mail;

Examples

Sending an email

The following example demonstrates how you can send a basic email

$mail = Mail::getDriver('mailgun');
$mail->setKey('your_maligun_api_key');
$mail->setDomain('your_domain');
$mail->setTo('test@test.com');
$mail->setFrom('test-from@test.com');
$mail->setSubject('This is a test subject');
$mail->setBody('Lorem ipsum dolor sit amet, mollis hendrerit vix at. Altera meliore signiferumque vix an. Sonet delectus assentior eu sed, cu meliore ponderum quo. At quo idque virtute. Impedit mentitum est ei, assum abhorreant eam cu.');
$mail->send();

Sending a batch email

The following example demonstrates how you can send batch emails.

$mail = Mail::getDriver('mailgun');
$mail->setKey('your_maligun_api_key');
$mail->setDomain('your_domain');
$mail->setTo([
    'test@test.com',
    'test2@test.com'
]);
$mail->setFrom('test-from@test.com');
$mail->setSubject('This is a test subject');
$mail->setBody('Lorem ipsum dolor sit amet, mollis hendrerit vix at. Altera meliore signiferumque vix an. Sonet delectus assentior eu sed, cu meliore ponderum quo. At quo idque virtute. Impedit mentitum est ei, assum abhorreant eam cu.');
$mail->send();

For further examples look in the tests/index.php.

Built With

  • PHP 7

Versioning

We use Semantic Versioning 1.0.0, for example v1.0.0.

Authors

  • Sam Oliveri - Software Engineer

License

Text is open-sourced software licensed under the MIT license.