Setting up Mandrill Webhooks with Laravel
I really love the simplicity of transactional email API services such as Mandrill.
It’s so much easier to send application emails when all you need to do is to make an API request, rather than dealing with the headache of an email server.
However, when sending emails, there is a lot of things that can go wrong.
Emails can be rejected, bounced, or marked as spam, leaving your users wondering why they did not receive their confirmation, invitation, or notification from a friend.
![enter image description here][1]
One of the benefits of using a service such as Mandrill is that they also provide Webhooks (What are Webhooks?) on events such as when the email was opened, a link was clicked, or when the email was rejected, or bounced.
This means we can listen for these Webhooks and take the appropriate action to notify the user of the problem, so they are not left in the dark.
In today’s tutorial we are going to be looking at setting up and using Mandrill Webhooks in a Laravel application.
The problem we are looking to resolve
Imagine we’re building a Project Management application that allows teams of users to collaboratively work together to deliver a project.
An important part of the on-boarding process is inviting new team members to the application so they can also work on the project.
However, if the invitation email is rejected or it is bounced, the invited user will be left in limbo and unable to access the project.
In order to solve this problem we need a way of notifying the user who sent the invitation of the rejection so they can double check to make sure the email address they entered was correct.
And lo and behold, this is the perfect situation to use Mandrill’s Webhooks!
We need to set up a Mandrill Webhook that will be triggered whenever an email is rejected or bounced.
How this is going to work
Mandrill will send us a PO
Link:
This post is submitted by our members. Submit a new post.
Tags: Tutorials Laravel 5 Laravel 5.1 Laravel 5.2 Intermediate