Log In

This library provides a simple way to send email via the SMTP2GO API and also access other endpoints in the API in a standard way.

Step 1

Sending an Email Example

use SMTP2GO\ApiClient;
use SMTP2GO\Service\Mail\Send as MailSend;

$sendService = new MailSend(
    ['sender@email.test', 'Sender Name'],
        ['recipient@email.test', 'Recipient Name'],
        ['recipient2@email.test', 'Recipient Name 2'],
    'Test Email',
    '<h1>Hello World</h1>'

$sendService->addAddress('cc', 'cc@email.test');
$sendService->addAddress('bcc', 'bcc@email.test');

$sendService->setAttachments(['/path/to/attachment', '/path/to/another_attachment']);
$sendService->setInlines(['/path/to/inline_attachment', '/path/to/another_inline_attachment']);

$sendService->addCustomHeader('Reply-To', 'replyto@email.test');

$apiClient = new ApiClient('api-YOURAPIKEY');

$success = $apiClient->consume($sendService);

$responseBody = $apiClient->getResponseBody();

Ready for better email delivery?

Try SMTP2GO free for as long as you like:

Try SMTP2GO Free → Paid plans available for over 1,000 emails/month.