Skip to content
131 STUDIOS
Home / Blog / Parse MIME Messages from your S3 Bucket
Laravel ·AWS

Parse MIME Messages from your S3 Bucket

Parse incoming mail messages with Laravel and AWS S3.

R
Robert Fountain
Founder · 131 Studios
Published
Jul 7, 2025
Read time
1 min

You can use this to parse incomming messages to a mailbox and then import them into a ticketing system or blog, etc. Built for Laravel applications, you can check out the Github repository

Installation

Require the package with composer.

composer require onethirtyone/aws-s3-mime-handler

You'll also need to make sure your AWS environment variables are set

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET=

## Usage

The `MessageCollector`facade will return a collection of `OneThirtyOne\Mime\Message` instances. Each of these instances is a fully parsed MIME message from your bucket. You can access the properties:

MessageCollector::fromBucket()->each(function ($message) {
$message->id;    // The message file name
$message->to;    // Message recipient
$message->from; // Message Sender
$message->subject;  // Message Subject
$message->body;  // The body of the message (plain text)
});

You can delete a message by calling the `delete()`method on a message object

$message = MessageCollector::fromBucket()->first();$message->delete();

Need help with your next project? We'd love to hear from you.

Need help with your next project?

I build custom websites and applications for businesses ready to grow online.

Book a free consult
Or reach out direct
Call the studio