Skip to main content

Introduction

This documentation explains how to handle webhooks generated by MailCare automations, including the request headers and body structure you will receive in your application. MailCare allows you to create automations via the web interface or API, enabling the generation of webhooks on your application for each received email that matches the defined rules in the automations. For instance, if you want to receive a webhook on your application every time an email with an attachment arrives on MailCare, you need to:
  • Begin by creating an automation via API or Web with the title catch email with attachment and check the box Trigger on Attachment, then enter the Webhook URL to Call, which is the URL of your application.
  • Next, in your application, you just need to handle this incoming request, which will be a POST on the URL defined above.
Screenshot of creating an automation via webhook

Request Headers

Here is the list of request headers you could receive:
The X-MailCare-* headers provide information about why you are receiving this request, which automation generated this webhook, and what match was made.

Request Body in JSON Metadata Email

If you select the following format JSON Metadata Email (Content-Type: application/json)

Request Body in RAW Email

If you select the following format RAW Email (Content-Type: message/rfc2822)

Request Body in JSON Metadata Email with HTML/Text Bodies

If you select the following format JSON Metadata Email with HTML/Text Bodies (Content-Type: application/json)

How to Integrate MailCare with Your Laravel 11 Application

For a detailed guide on integrating MailCare with your Laravel 11 application, you can read the following blog post: Read the following blog post