PHPackages                             clinically-au/laravel-smtp2go - 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. clinically-au/laravel-smtp2go

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

clinically-au/laravel-smtp2go
=============================

Laravel Mail transport driver for SMTP2Go API

v1.2.1(3w ago)02.3k↑1014.3%[2 PRs](https://github.com/clinically-au/laravel-smtp2go/pulls)MITPHPPHP ^8.4CI failing

Since Dec 12Pushed 2w agoCompare

[ Source](https://github.com/clinically-au/laravel-smtp2go)[ Packagist](https://packagist.org/packages/clinically-au/laravel-smtp2go)[ Docs](https://github.com/clinically-au/laravel-smtp2go)[ RSS](/packages/clinically-au-laravel-smtp2go/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (36)Versions (9)Used By (0)

SMTP2Go Laravel Mail Transport
==============================

[](#smtp2go-laravel-mail-transport)

[![Tests](https://camo.githubusercontent.com/2b20383d496906f35d47cbda133b8ac8fa6ab9f24f923fcc8cc76ce05f028118/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f636c696e6963616c6c792d61752f6c61726176656c2d736d747032676f2f72756e2d74657374732e796d6c3f6c6162656c3d7465737473)](https://github.com/clinically-au/laravel-smtp2go/actions)[![Latest Version on Packagist](https://camo.githubusercontent.com/ef235f153a1e1dc397b47d072884135d91b9f1129e791972c9a1262823b5e6fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636c696e6963616c6c792d61752f6c61726176656c2d736d747032676f2e737667)](https://packagist.org/packages/clinically-au/laravel-smtp2go)[![Total Downloads](https://camo.githubusercontent.com/c68fd3c416a33134fe5a5f4cd1c75dd0bbd7f8296649d635012f9a40b3c2f81a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636c696e6963616c6c792d61752f6c61726176656c2d736d747032676f2e737667)](https://packagist.org/packages/clinically-au/laravel-smtp2go)[![License](https://camo.githubusercontent.com/a5fae840b825ab51b78e404d9e83d21e910819fda593de957b08f40354b1dea3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636c696e6963616c6c792d61752f6c61726176656c2d736d747032676f2e737667)](https://packagist.org/packages/clinically-au/laravel-smtp2go)

A Laravel Mail transport driver for sending emails via the [SMTP2Go](https://www.smtp2go.com/) API. This package provides seamless integration with Laravel's built-in mail system.

Features
--------

[](#features)

- ✅ Full Laravel Mail API support
- ✅ Supports HTML and plain text emails
- ✅ File attachments with automatic Base64 encoding
- ✅ CC and BCC recipients
- ✅ Queue integration for background processing
- ✅ Automatic retries on failure
- ✅ Laravel 11 &amp; 12 compatible
- ✅ PHP 8.4+ support
- ✅ Comprehensive test coverage

Requirements
------------

[](#requirements)

- PHP 8.4+
- Laravel 11.0+ or 12.0+
- SMTP2Go API key ([Get one here](https://www.smtp2go.com/pricing/))

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

[](#installation)

Install the package via Composer:

```
composer require clinically-au/laravel-smtp2go
```

The service provider will be automatically registered.

Configuration
-------------

[](#configuration)

### 1. Add Environment Variables

[](#1-add-environment-variables)

Add your SMTP2Go API key to your `.env` file:

```
SMTP2GO_API_KEY=your-api-key-here
```

### 2. Configure Mail Driver

[](#2-configure-mail-driver)

Add the SMTP2Go mailer to your `config/mail.php`:

```
'mailers' => [
    'smtp2go' => [
        'transport' => 'smtp2go',
    ],

    // ... other mailers
],
```

### 3. Set as Default (Optional)

[](#3-set-as-default-optional)

To use SMTP2Go as your default mailer:

```
MAIL_MAILER=smtp2go
```

Or in `config/mail.php`:

```
'default' => env('MAIL_MAILER', 'smtp2go'),
```

### 4. Publish Config (Optional)

[](#4-publish-config-optional)

If you need to customize the configuration:

```
php artisan vendor:publish --tag="smtp2go-config"
```

This will create `config/smtp2go.php`:

```
return [
    'endpoint' => env('SMTP2GO_ENDPOINT', 'https://api.smtp2go.com/v3'),
    'api_key' => env('SMTP2GO_API_KEY', ''),
];
```

Usage
-----

[](#usage)

### Basic Email Sending

[](#basic-email-sending)

Once configured, use Laravel's Mail facade as normal:

```
use Illuminate\Support\Facades\Mail;
use App\Mail\WelcomeEmail;

Mail::to('user@example.com')
    ->send(new WelcomeEmail($user));
```

### Using a Specific Mailer

[](#using-a-specific-mailer)

If you have multiple mailers configured:

```
Mail::mailer('smtp2go')
    ->to('user@example.com')
    ->send(new InvoicePaid($invoice));
```

### Queued Emails

[](#queued-emails)

Send emails in the background using Laravel's queue system:

```
Mail::to($user)
    ->queue(new OrderShipped($order));
```

### Email with CC and BCC

[](#email-with-cc-and-bcc)

```
Mail::to('primary@example.com')
    ->cc('manager@example.com')
    ->bcc('archive@example.com')
    ->send(new MonthlyReport($data));
```

### Email with Attachments

[](#email-with-attachments)

```
use Illuminate\Mail\Mailables\Attachment;

class InvoiceEmail extends Mailable
{
    public function content()
    {
        return new Content(
            view: 'emails.invoice',
        );
    }

    public function attachments()
    {
        return [
            Attachment::fromPath('/path/to/invoice.pdf'),
        ];
    }
}
```

### HTML and Plain Text

[](#html-and-plain-text)

```
class WelcomeEmail extends Mailable
{
    public function content()
    {
        return new Content(
            view: 'emails.welcome.html',
            text: 'emails.welcome.text',
        );
    }
}
```

Testing
-------

[](#testing)

### Package Test Suite

[](#package-test-suite)

The package includes a comprehensive test suite:

```
composer test
```

### Testing with Real SMTP2Go API

[](#testing-with-real-smtp2go-api)

To verify the package works with your SMTP2Go account, use the included test script:

```
# 1. Configure your API credentials
cp test-app/.env.example test-app/.env
# Edit test-app/.env and add your SMTP2GO_API_KEY

# 2. Run the test
php test-app/send-test-email.php
```

See [test-app/README.md](test-app/README.md) for detailed instructions.

### Testing in Your Application

[](#testing-in-your-application)

Use Laravel's mail faking in your tests:

```
use Illuminate\Support\Facades\Mail;
use App\Mail\OrderConfirmation;

public function test_order_sends_confirmation_email()
{
    Mail::fake();

    // Perform action that sends email
    $this->post('/orders', $orderData);

    // Assert email was sent
    Mail::assertSent(OrderConfirmation::class, function ($mail) {
        return $mail->hasTo('customer@example.com');
    });
}
```

How It Works
------------

[](#how-it-works)

This package implements Laravel's custom mail transport interface by:

1. Extending Symfony's `AbstractTransport` class
2. Converting Laravel mail messages to SMTP2Go API format
3. Sending via SMTP2Go's REST API with Guzzle HTTP client
4. Automatic Base64 encoding of attachments
5. Proper formatting of email addresses (Name )

All error handling, retries, and queue integration are handled by Laravel's mail system automatically.

API Documentation
-----------------

[](#api-documentation)

For detailed SMTP2Go API documentation, see:

- [Send Email Endpoint](https://developers.smtp2go.com/reference/send-standard-email)
- [API Reference](https://developers.smtp2go.com/)

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Contributions are welcome! Please see our [contributing guidelines](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Wojt Janowski](https://github.com/clinically-au)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance96

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.4% 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 ~57 days

Total

5

Last Release

21d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f2ea2e401c2f1f18cafc42d8fb98305ae3575db1fb25455af1c3156d0e79f90e?d=identicon)[wojt-janowski](/maintainers/wojt-janowski)

---

Top Contributors

[![wojt-janowski](https://avatars.githubusercontent.com/u/209190810?v=4)](https://github.com/wojt-janowski "wojt-janowski (14 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelmailemailmailertransportsmtp2go

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/clinically-au-laravel-smtp2go/health.svg)

```
[![Health](https://phpackages.com/badges/clinically-au-laravel-smtp2go/health.svg)](https://phpackages.com/packages/clinically-au-laravel-smtp2go)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k113.1M998](/packages/laravel-socialite)[propaganistas/laravel-disposable-email

Disposable email validator

6023.2M7](/packages/propaganistas-laravel-disposable-email)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.6k26.0M810](/packages/laravel-boost)[spatie/laravel-health

Monitor the health of a Laravel application

88212.7M189](/packages/spatie-laravel-health)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5226.7k](/packages/simplestats-io-laravel-client)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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