Skip to content

PHP-Email provides a cross-platform emailing API which includes standard emailing features (eg. setting the subject, body, attachments, etc).

License

Notifications You must be signed in to change notification settings

onassar/PHP-Email

Repository files navigation

PHP Email

PHP-Email provides a cross-platform emailing API which includes standard emailing features (eg. setting the subject, body, attachments, etc).

Currently limited to Mailgun and Postmark.

Sample Mailgun emailing

// load dependencies
require_once APP . '/vendors/source/mailgun-php/v1.7.1/autoload.php';
require_once APP . '/vendors/submodules/PHP-Email/PlatformUtils.class.php';
require_once APP . '/vendors/submodules/PHP-Email/MailgunUtils.class.php';
require_once APP . '/vendors/submodules/PHP-Email/OutboundEmail.class.php';
require_once APP . '/vendors/submodules/PHP-Email/MailgunEmail.class.php';

// setup
onassar\Email\MailgunUtils::addOutboundSignatures($signatures);
onassar\Email\MailgunUtils::addRecipientWhitelistPatterns($patterns);
onassar\Email\MailgunUtils::setAPIKey($apiKey);

// send
$email = new onassar\Email\MailgunEmail();
$email->addToRecipient($address);
$email->setSubject($subject);
$email->setBody($body);
$success = $email->send();
$sendId = $email->getSendId();

Sample Postmark Mailing

// load dependencies
require_once APP . '/vendors/source/postmark-php/v0.5/src/Postmark/Mail.php';
require_once APP . '/vendors/submodules/PHP-Email/PlatformUtils.class.php';
require_once APP . '/vendors/submodules/PHP-Email/PostmarkkUtils.class.php';
require_once APP . '/vendors/submodules/PHP-Email/OutboundEmail.class.php';
require_once APP . '/vendors/submodules/PHP-Email/PostmarkEmail.class.php';

// setup
onassar\Email\PostmarkUtils::addOutboundSignatures($signatures);
onassar\Email\PostmarkUtils::addRecipientWhitelistPatterns($patterns);
onassar\Email\PostmarkUtils::setAPIKey($apiKey);

// send
$email = new onassar\Email\PostmarkEmail();
$email->addToRecipient($address);
$email->setSubject($subject);
$email->setBody($body);
$success = $email->send();
$sendId = $email->getSendId();

About

PHP-Email provides a cross-platform emailing API which includes standard emailing features (eg. setting the subject, body, attachments, etc).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages