oliveris / sdk-mail
Sends email and campaigns to a provider specified.
Installs: 63
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
- mailgun/mailgun-php: ^2.6
- php-http/guzzle6-adapter: ^1.1
- php-http/message: ^1.7
This package is auto-updated.
Last update: 2025-03-18 04:03:40 UTC
README
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.