syntaxerro/mail-api-sdk

This package is abandoned and no longer maintained. No replacement package was suggested.

Simple PHP SDK for syntax-shell.me HTTP <=> SMTP|IMAP api

1.0 2016-04-17 10:17 UTC

This package is not auto-updated.

Last update: 2023-10-06 13:43:42 UTC


README

Installation

composer require syntaxerro/mail-api-sdk

Test

phpunit --bootstrap=vendor/autoload.php tests/ 

Usage

require __DIR__.'/src/SyntaxErro/SyntaxServer.php';
require __DIR__.'/src/SyntaxErro/SmtpBundle/SyntaxEmail.php';
require __DIR__.'/src/SyntaxErro/SmtpBundle/SmtpException.php';
// or use composer for auto-loading

/* Login using email address and password. */
$server = new \SyntaxErro\SyntaxServer("smtp@sntx.ml", "smtp-api-sdk");

/* Create new message to recipient@example.com with content. */
$message = new \SyntaxErro\SmtpBundle\SyntaxEmail("Hello. I'm testing your API.", "recipient@example.com");

/* Set subject of message */
$message->setSubject("It's a test message!");

/* Set reply-to header. */
$message->setReplyTo("other@email.com");

/* Set my full name displayed instead of emails address. */
$message->setAs("Darth Vader");

/* Send message. */
$server->send($message);
Multiple recipients
$message = new \SyntaxErro\SmtpBundle\SyntaxEmail("Hello. I'm testing your API.", ["recipient@example.com", "other@recipient.com"]);

or

$message = new \SyntaxErro\SmtpBundle\SyntaxEmail("Hello. I'm testing your API.");
$message
    ->addRecipient("recipient@example.com")
    ->addRecipient("other@recipient.com");