Log In

Integrating the SMTP2GO PHP Package for reliable and fast email delivery.

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.

For more information about API, see our API documentation.

We have created an excellent migration guide to help you move to SMTP2GO from your existing provider.

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();

Integrating the SMTP2GO PHP Package should be an easy, quick and, hopefully, painless process.

You can access reports directly in your SMTP2GO dashboard, which will help you understand delivery successes and failures, tracking information and many more useful metrics. We’ve written some great articles outlining the features of your SMTP2GO account and we recommend taking the time to see everything we have to offer.

Should you need extra help from our award-winning support team, we are almost always available to assist. You can find support contact details in your SMTP2GO dashboard and information about retrieving your support PIN here.

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.