Coder Social home page Coder Social logo

larajet's Introduction

Larajet

Package version Software License Coverage Status Quality Score Total downloads

Larajet is a mail transport for Laravel. It is a MailJet integration package. Much like Mailgun, this allows for sending Mail via the mailjet api (based on Mailjet API v3.) It supports Mailables and Notifables.

Sboo had already done a lot of the heavy lifting.

Install

Via Composer

$ composer require robrogers3/larajet

You will need to update app.php

In Package Service Providers add

Larajet\MailjetServiceProvider::class

Also, add this line to the 'aliases' array 'MailJet' => Larajet\Facades\MailJet::class,

Then you need to configure services.php. Add this:

    'mailjet' => [
        'public_key' => env('MAILJET_PUBLIC_KEY'),
        'private_key' => env('MAILJET_PRIVATE_KEY'),
        'from' => env('MAIL_FROM'),
        'driver' => env('MAIL_DRIVER'),
        'guzzle' => [],
        'api_url' => 'https://api.mailjet.com/v3/send'
    ],

You will need to update your .env file accordingly.

Usage

The best way is to create a Mailable. e.g.

php artisan make:mail TestMail

Then just mail it!

use App\Mail\TestMail;

Mail::to([email protected])
        ->subject('Test Mail')
        ->send(new TestMail);

Learn about Mailables

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

There is only one test. It tests the mail was sent.

Basically the steps are:

  • Call a console command, or hit a route that sends an email.
  • There are no more steps.

A route might look like:

use App\Mail\TestMail;

Route::get('/sendmail', function() {
    Mail::to(\App\User::first()->email)
        ->send(new TestMail);
    return 'sent?';
});

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

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

Credits

License

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

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.