Giter VIP home page Giter VIP logo

http-mail-driver's Introduction

Laravel HTTP mail driver

Latest Version on Packagist Total Downloads

This package gives your the ability to send emails via HTTP requests. This is useful for sending emails via Mailchannels and their Cloudflare Workers partnerships but can be used for other applications. Note: There is currently no support for attachments due to Mailchannels not supporting them via their transactional message api.

Installation

You can install the package via composer:

composer require skyracer2012/http-mail-driver

After that, please set the value HTTP_MAIL_URL in your .env file to the URL of your HTTP Mail endpoint. You should also define the HTTP_MAIL_KEY in your .env file which will be used to authenticate your requests in the Authorization header.

HTTP_MAIL_URL=https://webhook.example.com
HTTP_MAIL_KEY=secret

Optionally you can also add DKIM data, which is useful for the mailchannels integration. See the config entry for further information. Make sure this matches your mail sender configuration to avoid dmarc issues!

HTTP_MAIL_DKIM_ENABLED=true
HTTP_MAIL_DKIM_DOMAIN=example.com
HTTP_MAIL_DKIM_SELECTOR=mailchannels
HTTP_MAIL_DKIM_PRIVATE_KEY=yourprivatkey

Next should should add the http entry to your config/mail.php file under the mailers array.

'mailers' => [
    // other mailers
    'http' => [
        'transport' => 'http',
        'url' => env('HTTP_MAIL_URL'),
        'key' => env('HTTP_MAIL_KEY'),
        //DKIM settings. Look at https://developers.cloudflare.com/pages/platform/functions/plugins/mailchannels/#dkim-support-for-mailchannels-api for more information
        'dkim_enabled' => env('HTTP_MAIL_DKIM_ENABLED', false), //Whether to enable DKIM in the database
        'dkim_domain' => env('HTTP_MAIL_DKIM_DOMAIN'), //The domain you are sending the email from.
        'dkim_selector' => env('HTTP_MAIL_DKIM_SELECTOR'), //Specifies where to find the associated public key in your DNS records
        'dkim_private_key' => env('HTTP_MAIL_DKIM_PRIVATE_KEY'), //The base-64 encoded private key.
    ],
],

Now you can set the default mailer to http in your .env file.

MAIL_MAILER=http

Cloudflare Mailchannel integration

⚠️ Mailchannels now enforces Domain Lockdown™: Please create DNS record according to their help center article!

This package was made to work in combination with the Cloudflare Worker Mailchannels partnership. To use this, deploy a worker with the code of this gist: https://gist.github.com/skyracer2012/54e85953162f24ac8f8e0a0fa747f1e3

Credits

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

http-mail-driver's People

Contributors

andrewxtsang avatar skyracer2012 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.