vemcogroup / laravel-sparkpost-driver

SparkPost driver to use with Laravel
MIT License
40 stars 16 forks source link

Best way to set up in Laravel 7.0 #2

Closed alvarose closed 4 years ago

alvarose commented 4 years ago

In my new Laravel 7.0 project, I don't know how to configure SparkPost with this package. In the ReadMe it is not very clear how to do it.

eldor commented 4 years ago

Hi,

I can see that Laravel 7.x have changed the settings name in .env from MAIL_DRIVER to MAIL_MAILER so i have updated the readme.

  1. You have to install the package.

composer require vemcogroup/laravel-sparkpost-driver

  1. Then in your config/services.php you need to insert this
    'sparkpost' => [
    'secret' => env('SPARKPOST_SECRET'),
    'guzzle' => [
        'verify' => true,
        'decode_content' => true,
        ...
    ],
    'options' => [
        'endpoint' => env('SPARKPOST_ENDPOINT'),
        'open_tracking' => false,
        'click_tracking' => false,
        'transactional' => true,
    ],
    ],

Then insert the following into your .env file with the correct values from your sparkpost account

MAIL_MAILER=sparkpost
SPARKPOST_SECRET=
SPARKPOST_ENDPOINT=

Then your application will use sparkpost.

alvarose commented 4 years ago

config/mail.php also changed in Laravel 7.0

With your config: Mailer [sparkpost] is not defined.

eldor commented 4 years ago

You need to add the sparkpost settings (2) in mail.php 'mailer' section instead of services.php:

'mailers' => [
    'sparkpost' => [
        'secret' => env('SPARKPOST_SECRET'),
        'guzzle' => [
            'verify' => true,
            'decode_content' => true,
           ...
        ],
        'options' => [
            'endpoint' => env('SPARKPOST_ENDPOINT'),
            'open_tracking' => false,
            'click_tracking' => false,
            'transactional' => true,
        ],
    ],
]
alvarose commented 4 years ago

At the moment, I get a 503 errorService Temporarily Unavailable. I will continue testing.

eldor commented 4 years ago

Hmm, i see, will investigate

eldor commented 4 years ago

Hi @AlvaroSE think i found out a way to use this package in L7, have updated the README.ME with and Laravel 7.x description in the bottom.

Let me know if it works

alvarose commented 4 years ago

In my case no, I still getting error 503. :(

g0shed commented 4 years ago

also not working for my Laravel 7 installation

eldor commented 4 years ago

I just tried a new L7 installation with the setup in Readme and mails are sent from the system without issues. Could you add some logs or error messages?

eldor commented 4 years ago

Fixed with pull-requests #4 and #5 tagged version 3.0.1 Thanks to @g0shed