LaravelPackages.net
Acme Inc.
Toggle sidebar
spatie/laravel-mailcoach-mailer

The driver for sending transactional mails using Mailcoach in Laravel

589.131
26
1.7.0
About spatie/laravel-mailcoach-mailer

spatie/laravel-mailcoach-mailer is a Laravel package for the driver for sending transactional mails using mailcoach in laravel. It currently has 26 GitHub stars and 589.131 downloads on Packagist (latest version 1.7.0). Install it with composer require spatie/laravel-mailcoach-mailer. Discover more Laravel packages by spatie or browse all Laravel packages to compare alternatives.

Last updated

The driver for sending transactional mails using Mailcoach in Laravel

Latest Version on Packagist Total Downloads

Mailcoach is an affordable platform for all things mail. It can send campaigns to list of any size. It also provides flexible email automation to set up drip campaigns and more.

Finally, you can also use Mailcoach to send transactional mails. This package contains a driver so you can send any mailable through Mailcoach.

// will be sent through mailcoach

Mail::to('[email protected]')->send(new OrderShippedMail());

On mailcoach.app, you can see an archive of sent mails.

screenshot

If you activated the feature, you can also see the opens and clicks of all transactional mails. It's also possible to resend any transactional mails straight from the Mailcoach UI.

Additionally, you'll also be able to create email templates on Mailcoach and use those templates in your app. This is great for marketeers without technical knowledge. They can now write mails without a developer needing to make any code changes.

This is how you would send a mail using a Mailcoach template.

public function build()
{
    $this
        ->mailcoachMail('name-of-your-mailcoach-template')
        ->replacing(['placeholderName' => 'placeHolderValue']);
}

If you want to send a mail notification using a mailcoach template, you can do that in the following way.

public function toMail()
{
    return (new MailCoachMessage())
        ->usingMail('name-of-your-mailcoach-template')
        ->replacing(['placeholderName' => 'placeHolderValue']);
}

Support us

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.

Documentation

You'll find full documentation on this page of the Mailcoach docs.

Custom API base URL

By default, mails are sent to https://{domain}/api/transactional-mails/send. For self-hosted installations, you can send them to another base URL, for example an internal service over HTTP, by adding the optional api_base_url key to your mailer config:

// config/mail.php

'mailcoach' => [
    'transport' => 'mailcoach',
    'domain' => env('MAILCOACH_DOMAIN'),
    'token' => env('MAILCOACH_API_TOKEN'),
    'api_base_url' => env('MAILCOACH_API_BASE_URL'),
],

Set MAILCOACH_API_BASE_URL to an absolute HTTP or HTTPS URL, such as http://mailcoach-service:8080 or https://internal.example.com/mailcoach. A port and path prefix are optional. Do not include /api/transactional-mails/send, a query string, or a fragment: the transport appends the endpoint itself and removes trailing slashes.

The override takes precedence over domain, but domain and token remain required config keys. Omitting api_base_url, or setting it to null or an empty string, keeps the default HTTPS URL based on domain.

Only use HTTP on a trusted network: the token and mail content are sent without TLS encryption.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

Comments
Affiliate link

Get paid by clients abroad

Wise gives you local bank details in several currencies and converts at the mid-market rate. Useful when your invoices are not in your own currency.

Try Wise

Star History Chart

Get the next ones by email

New Laravel packages worth a look, once a month. No spam, one-click unsubscribe.