Skip to content
Advertisement

Spatie/Newsletter: MailChimp Invalid MailChimp API key “ supplied in Laravel 5.6

Good morning all of you,

I’m currently working on using spatie/newsletter in my laravel 5.6 Blog to work with MailChimp to create a newsletter where users can subscribe.

When I try to subscribe, I get this response:

JavaScript

My Controller

JavaScript

Env File

JavaScript

newsletter.php (after running php artisan vendor:publish -provider=”SpatieNewsletterNewsletterServiceProvider”)

JavaScript

I have also added the
SpatieNewsletterNewsletterServiceProvider::class,

into the app/config providers aswell as

JavaScript

to the aliases in the app/config.

I really don’t know why it is not working at this point.

I tried to give all necessary information. Api Key is valid and Status is ok. List Id is valid aswell.

Thank you in advance! Domi

Advertisement

Answer

I found the solution myself, it took me a while to figure it out.

First: In the newsletter.php class, when I configured my lists, I forgot to change the name of the list from 'subsribers' to 'nameOfListInMailChimp'.

Second thing I needed to do was:

  • php artisan config:cache

Because every time you make a change in the .env file, you have to clear the cache to make the changes work.

I hope this is helpful for other people, this basically could be used as a complete How- to-configure Spatie Newsletter 😉

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement