All Projects → mailersend → mailersend-laravel-driver

mailersend / mailersend-laravel-driver

Licence: MIT License
The official MailerSend Laravel Driver

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to mailersend-laravel-driver

Sendgrid Csharp
The Official Twilio SendGrid Led, Community Driven C#, .NetStandard, .NetCore API Library
Stars: ✭ 835 (+5864.29%)
Mutual labels:  email, transactional-emails
Sendgrid Php
The Official Twilio SendGrid Led, Community Driven PHP API Library
Stars: ✭ 1,257 (+8878.57%)
Mutual labels:  email, transactional-emails
Cuttlefish
Transactional email server with a lovely web interface
Stars: ✭ 985 (+6935.71%)
Mutual labels:  email, transactional-emails
Sendgrid Java
The Official Twilio SendGrid Led, Community Driven Java API Library
Stars: ✭ 380 (+2614.29%)
Mutual labels:  email, transactional-emails
Mailjet Apiv3 Php
[API v3] Mailjet PHP Wrapper
Stars: ✭ 194 (+1285.71%)
Mutual labels:  email, transactional-emails
Sendgrid Ruby
The Official Twilio SendGrid Led, Community Driven Ruby API Library
Stars: ✭ 520 (+3614.29%)
Mutual labels:  email, transactional-emails
Sendgrid Python
The Official Twilio SendGrid Led, Community Driven Python API Library
Stars: ✭ 1,125 (+7935.71%)
Mutual labels:  email, transactional-emails
Mailjet Apiv3 Java
[API v3] Mailjet Java API Wrapper
Stars: ✭ 53 (+278.57%)
Mutual labels:  email, transactional-emails
Laravel Postmark
A Postmark adapter for Laravel
Stars: ✭ 143 (+921.43%)
Mutual labels:  email, transactional-emails
Mailjet Apiv3 Nodejs
[API v3] Official Mailjet API v3 NodeJS wrapper
Stars: ✭ 137 (+878.57%)
Mutual labels:  email, transactional-emails
Grunt Email Workflow
A Grunt workflow for designing and testing responsive HTML email templates with SCSS.
Stars: ✭ 3,010 (+21400%)
Mutual labels:  email, transactional-emails
mailersend-nodejs
The official MailerSend Node.js SDK
Stars: ✭ 41 (+192.86%)
Mutual labels:  transactional-emails, mailersend
Magento2 Gmail Smtp App
Configure Magento 2 to send email using Google App, Gmail, Amazon Simple Email Service (SES), Microsoft Office365 and many other SMTP (Simple Mail Transfer Protocol) servers
Stars: ✭ 281 (+1907.14%)
Mutual labels:  email, transactional-emails
Sendgrid Go
The Official Twilio SendGrid Led, Community Driven Golang API Library
Stars: ✭ 710 (+4971.43%)
Mutual labels:  email, transactional-emails
Mailjet Gem
[API v3] Mailjet official Ruby GEM
Stars: ✭ 119 (+750%)
Mutual labels:  email, transactional-emails
Sendgrid Nodejs
The Official Twilio SendGrid Led, Community Driven Node.js API Library
Stars: ✭ 2,543 (+18064.29%)
Mutual labels:  email, transactional-emails
mailersend-php
The official MailerSend PHP SDK
Stars: ✭ 23 (+64.29%)
Mutual labels:  transactional-emails, mailersend
mailtrap
MailTrap has been renamed to Sendria. Please use Sendria now, MailTrap is abandoned. MailTrap is a SMTP server designed to run in your dev/test environment, that is designed to catch any email you or your application is sending, and display it in a web interface instead of sending to real world.
Stars: ✭ 14 (+0%)
Mutual labels:  email
bulletproof-email
A Gulp workflow for maintainable email templates
Stars: ✭ 71 (+407.14%)
Mutual labels:  email
ContextIO-node
[DEPRECATED] - Official Node.js client library for the Context.IO Email API
Stars: ✭ 86 (+514.29%)
Mutual labels:  email

MailerSend Laravel Driver

MIT licensed

Table of Contents

Installation

Requirements

For Laravel 7.x - 8.x support see 1.x branch

Setup

You can install the package via composer:

composer require mailersend/laravel-driver

After that, you need to set MAILERSEND_API_KEY in your .env file:

MAILERSEND_API_KEY=

Add MailerSend as a Laravel Mailer in config/mail.php in mailers array:

'mailersend' => [
    'transport' => 'mailersend',
],

And set environment variable MAIL_MAILER in your .env file

MAIL_MAILER=mailersend

Also, double check that your FROM data is filled in .env:

[email protected]
MAIL_FROM_NAME="App Name"

Usage

This is an example mailable that you can use to send an email with.

app/Mail/TestEmail.php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Arr;
use MailerSend\Helpers\Builder\Variable;
use MailerSend\Helpers\Builder\Personalization;
use MailerSend\LaravelDriver\MailerSendTrait;

class TestEmail extends Mailable
{
    use Queueable, SerializesModels, MailerSendTrait;

    public function build()
    {
        // Recipient for use with variables and/or personalization
        $to = Arr::get($this->to, '0.address');

        return $this
            ->view('emails.test_html')
            ->text('emails.test_text')
            ->attachFromStorageDisk('public', 'example.png')
            // Additional options for MailerSend API features
            ->mailersend(
                template_id: null,
                variables: [
                    new Variable($to, ['name' => 'Your Name'])
                ],
                tags: ['tag'],
                personalization: [
                    new Personalization($to, [
                        'var' => 'variable',
                        'number' => 123,
                        'object' => [
                            'key' => 'object-value'
                        ],
                        'objectCollection' => [
                            [
                                'name' => 'John'
                            ],
                            [
                                'name' => 'Patrick'
                            ]
                        ],
                    ])
                ],
                precedenceBulkHeader: true,
                sendAt: new Carbon('2022-01-28 11:53:20'),
            );
    }
}

We provide a MailerSendTrait trait that adds a mailersend method to the mailable and allows you to use additional options that are available through our API.

After creating the mailable, you can send it using:

use App\Mail\TestEmail;
use Illuminate\Support\Facades\Mail;

Mail::to('[email protected]')
    ->cc('[email protected]')
    ->bcc('[email protected]')
    ->send(new TestEmail());

Please refer to Laravel Mail documenation and MailerSend API documentation for more information.

Support and Feedback

In case you find any bugs, submit an issue directly here in GitHub.

If you have any troubles using our driver, feel free to contact our support by email [email protected]

Official API documentation is at https://developers.mailersend.com

License

The MIT License (MIT)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].