Skip to content

Laravel handle incoming emails in your application

Written by

sysadmin

Catch incoming emails in your Laravel application via laravel-mailbox package for Laravel 5.7 and up that will allow your application to catch and react to incoming emails from different services like Mailgun, SendGrid or the local log driver for debugging purposes.

to listen incoming email messages in a Laravel-Route like fashion and react to them.

Mailbox::from('info@maildomain.com', function (InboundEmail $email) {
	$subject = $email->subject();
});

more: https://beyondco.de/docs/laravel-mailbox/getting-started/introduction

accessing email attributes and content

Mailbox::from('{username}@gmail.com', function (InboundEmail $email, $username){
    $subject = $email->subject();
    $email->reply(new ReplyMailable);
});

github: https://github.com/beyondcode/laravel-mailbox

Previous article

Laravel create model, controller and migration in single artisan command