I recently needed the ability to receive emails and process attachments on those emails. I love Mailgun for the sending of transactional email, so when I needed to process incoming mail I started digging into Mailgun closer and realized their powerful inbound routing email features!
Come along and learn how you can set up a webhook to process inbound email and secure it within your Laravel applications. We will even use Laravel Valet (or ngrok directly) to test it out locally!
They start by talking about inbound routing: what it is and how it works using a request back from the Mailgun service. They briefly walk you through the setup of a Mailgun account and your DNS to use it for mail service. Next they create a new Laravel project, configure it for email with Mailgun and create the hook the webhook from Mailgun will reach back out to. They use Valet to share it via ngrok and configure the Mailgun account with the resulting URL. The post finishes up showing how to secure the webook via validation middleware and how to test it. They also share a few tips you can potentially use in the controller like using jobs for response handling and working with files.