PHPackages                             smtp2go-oss/smtp2go-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. smtp2go-oss/smtp2go-php

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

smtp2go-oss/smtp2go-php
=======================

A library for sending email through the SMTP2GO Api

1.1.7(8mo ago)1223.1k↓12.5%12MITPHPPHP &gt;=7.4.0

Since Jul 21Pushed 6mo ago4 watchersCompare

[ Source](https://github.com/smtp2go-oss/smtp2go-php)[ Packagist](https://packagist.org/packages/smtp2go-oss/smtp2go-php)[ RSS](/packages/smtp2go-oss-smtp2go-php/feed)WikiDiscussions development Synced 1mo ago

READMEChangelogDependencies (3)Versions (19)Used By (2)

SMTP2GO PHP API
===============

[](#smtp2go-php-api)

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.

Installation
------------

[](#installation)

`composer require smtp2go-oss/smtp2go-php`

Examples
--------

[](#examples)

### Sending an Email

[](#sending-an-email)

```
use SMTP2GO\ApiClient;
use SMTP2GO\Service\Mail\Send as MailSend;
use SMTP2GO\Types\Mail\Address;
use SMTP2GO\Collections\Mail\AddressCollection;
use SMTP2GO\Collections\Mail\AttachmentCollection;
use SMTP2GO\Types\Mail\FileAttachment;
use SMTP2GO\Types\Mail\InlineAttachment;
use SMTP2GO\Types\Mail\CustomHeader;

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

$sendService->setAttachments(new AttachmentCollection([ new FileAttachment('attachment-data','file1.txt'), new FileAttachment('another-attachment-data','file2.txt')]));

$inline = new InlineAttachment('a-cat-picture', file_get_contents('attachments/cat.jpg'), 'image/jpeg');

$sendService->addAttachment($inline);

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

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

#set a custom region
$apiClient->setApiRegion('us');

#set the client to retry using a different server ip if possible
$apiClient->setMaxSendAttempts(5);

#set the number of seconds to increase the request timeout with each attempt
$apiClient->setTimeoutIncrement(5);

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

$responseBody = $apiClient->getResponseBody();
```

### Sending email using a template

[](#sending-email-using-a-template)

This example is for the example template "User Welcome"

```
use SMTP2GO\ApiClient;
use SMTP2GO\Types\Mail\Address;
use SMTP2GO\Service\Mail\Send as MailSend;
use SMTP2GO\Collections\Mail\AddressCollection;

$client = new ApiClient('api-YOURAPIKEY');
$sendService = new MailSend(
    new Address('sender@site.test', 'Sender Name'),
    new AddressCollection([
        new Address('recipient@example.test', 'Bob Recipient'),
    ]),
    '', //subject is empty as this is defined in the template
    '', //body is empty as this is generated from the template
);
$sendService->setTemplateId(6040276);
$sendService->setTemplateData([
    "username" => "Steve",
    "product_name" => "Widgets",
    "action_url" => "https://website.localhost",
    "login_url" => "https://website.localhost/login",
    "guide_url" => "https://website.localhost/guide",
    "support_email" => "support@website.localhost",
    "sender_name" => "Bob Widgets"
]);

$res = $client->consume($sendService);
```

### Consuming an endpoint in the API using the generic Service class

[](#consuming-an-endpoint-in-the-api-using-the-generic-service-class)

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

$success = $client->consume((new Service('domain/verify', ['domain' => 'mydomain.tld'])));
```

License
-------

[](#license)

The package is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance65

Regular maintenance activity

Popularity35

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 88.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~101 days

Recently: every ~208 days

Total

16

Last Release

245d ago

PHP version history (2 changes)1.0.0betaPHP &gt;=7.2.0

1.1.4PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1316271e6e3d5d9118da4b7544c071176426457cdcb88a84d30f8e9774e1166b?d=identicon)[CodaKris](/maintainers/CodaKris)

---

Top Contributors

[![CodaKris](https://avatars.githubusercontent.com/u/13650641?v=4)](https://github.com/CodaKris "CodaKris (104 commits)")[![markcollister](https://avatars.githubusercontent.com/u/1679883?v=4)](https://github.com/markcollister "markcollister (10 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/smtp2go-oss-smtp2go-php/health.svg)

```
[![Health](https://phpackages.com/badges/smtp2go-oss-smtp2go-php/health.svg)](https://phpackages.com/packages/smtp2go-oss-smtp2go-php)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[guanguans/notify

Push notification SDK(AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

682104.9k7](/packages/guanguans-notify)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
