Coder Social home page Coder Social logo

laravel-postmark-provider's Introduction

Sunset Notice:

The Laravel Postmark Provider is no longer being actively updated. The following is a short discussion on the reasoning for discontinuing the provider. However, it's still really easy to still use Postmark in Laravel using SMTP, and since the SMTP provider is part of Laravel, it'll keep working when you update Laravel and you won't need to install any dependencies to use it.

Here's everything you'll need:

Update your config/mail.php file to include the following:

<?php
return [
    
    'username' => env('<YOUR_POSTMARK_SERVER_TOKEN>'),
    'password' => env('<YOUR_POSTMARK_SERVER_TOKEN>'),
    
    'host' => env('MAIL_HOST', 'smtp.postmarkapp.com'),
    
    // Optionally, set "smtp" to "log" if you want to trap emails during testing.
    'driver' => env('MAIL_DRIVER', 'smtp'), 
    
    'port' => env('MAIL_PORT', 587),
    'encryption' => env('MAIL_ENCRYPTION', 'tls'),
    
    /*
    |--------------------------------------------------------------------------
    | Global "From" Address
    |--------------------------------------------------------------------------
    |
    | You may wish for all e-mails sent by your application to be sent from
    | the same address. Here, you may specify a name and address that is
    | used globally for all e-mails that are sent by your application.
    |
    | It is also OK to not set this from address here and specify it on each message.
    |
    | Remember, when using Postmark, the sending address must be a valid 
    | Sender Signature that you have already configured.
    */
    'from' => ['address' => null, 'name' => null],
];

Advanced Integrations:

We provide an official PHP library that can be installed via composer to do more advanced Postmark integrations. If you want to move beyond basic email sending, Postmark-PHP will give you easy access to all Postmark API endpoints.

Keep using this provider anyway:

The Postmark Laravel Provider was built and will work with versions of Laravel up to 5.2, if you'd still like to use it, please feel free to follow the instructions below.

1. Install this package in your Laravel Project:
composer require wildbit/laravel-postmark-provider
2. Define your server token in your .env file:
POSTMARK_TOKEN=<YOUR_SERVER_TOKEN>
3. Add Postmark to your config/services.php file (it will use the token in your .env from Step 2):
'postmark' => env('POSTMARK_TOKEN'),
4. Update your application's MailProvider in your config/app.php file:

Find this line:

'Illuminate\Mail\MailServiceProvider',

And replace it with:

'Postmark\Adapters\LaravelMailProvider',

That's it! You've integrated Postmark into your Laravel Application.

laravel-postmark-provider's People

Contributors

atheken avatar bryceadams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-postmark-provider's Issues

Laravel 5.1

Just a heads up to let you know that this library doesn't seem to work for Laravel 5.1.

If i find some spare time, i will take a look and see if i can find the cause of the problem and potentially if there is a solution for it.

Catching PostMark Exceptions

Where is the best way to catch these kinds of errors?

GuzzleHttp\Exception\ClientException: Client error: `POST https://api.postmarkapp.com/email` resulted in a `422 Unprocessable Entity` response:
{"ErrorCode":406,"Message":"You tried to send to a recipient that has been marked as inactive.\nFound inactive addresses (truncated...)

Failure to send on Laravel 5.3

After following the instructions from the Packagist website:

FatalThrowableError in Mailer.php line 480:
Type error: Argument 1 passed to Illuminate\Mail\Mailer::setQueue() must implement interface Illuminate\Contracts\Queue\Factory, instance of Illuminate\Queue\SyncQueue given, called in /var/www/project/vendor/wildbit/laravel-postmark-provider/src/Postmark/Adapters/LaravelMailProvider.php on line 53

Doesn't work out of the box with Laravel 5.1

After doing a composer require wildbit/laravel-postmark-provider, we get

Using version ^1.0 for wildbit/laravel-postmark-provider
./composer.json has been updated
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: guzzlehttp/guzzle[6.1.0, 5.3.0].
    - Can only install one of: guzzlehttp/guzzle[5.3.0, 6.1.0].
    - Can only install one of: guzzlehttp/guzzle[5.3.0, 6.1.0].
    - wildbit/swiftmailer-postmark 1.1.0 requires guzzlehttp/guzzle ~5.2 -> satisfiable by guzzlehttp/guzzle[5.3.0].
    - wildbit/laravel-postmark-provider 1.0.0 requires wildbit/swiftmailer-postmark ~1.1 -> satisfiable by wildbit/swiftmailer-postmark[1.1.0].
    - Installation request for wildbit/laravel-postmark-provider ^1.0 -> satisfiable by wildbit/laravel-postmark-provider[1.0.0].
    - Installation request for guzzlehttp/guzzle == 6.1.0.0 -> satisfiable by guzzlehttp/guzzle[6.1.0].


Installation failed, reverting ./composer.json to its original content.

My composer.json looks like this:

"require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "laravel/socialite": "^2.0",
        "guzzlehttp/guzzle": "~5.3|~6.0"
    },

What can I do to use the official Laravel client? I know I can use SMTP to send my emails via Postmark, but it's too bad it doesn't work with the official Laravel client.

Problem sending text and html emails with attachment

It looks like when I try to send an email with both text and html views along with an attachment I only get the text view. Interestingly, the order of the values in the $views array affects the result.

For example:

    $views = [
        'emails_html',
        'emails_text',
    ];

    Mail::send($views, $data, function ($message) {
    ...

If I switch to using the standard Laravel mail it sends correctly.

Thanks for the really useful library!

Log driver not working

It's really tedious to test the app if the 'log' driver is not enabled using this provider.

Does not work with Laravel 5.2

Currently does not work with Laravel 5.2. In Laravel 5.2 they removed the pretend mail configuration option. They also removed the setLogger method on the Mailer class.

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.