An smtp server for recieving emails with laravel.
A basic SMTP server for recieving emails using Laravel.
THIS PACKAGE IS STILL IN DEVELOPMENT, USE AT YOUR OWN RISK
Install the package using composer with the following command:
composer require aaronschmied/laravel-smtpd
If you're running Laravel 5.5 or later, the service provider is automatically discovered. Otherwise add the following provider to your apps providers in
'providers' => [ ... \Smtpd\Providers\SmtpdServiceProvider::class, ],
Publish the config file using the command:
php artisan vendor:publish --provider="Smtpd\Providers\SmtpdServiceProvider"
This creates the
smtpd.php file in your config directory.
By default the server listens on any interface (
0.0.0.0) on port
Define the hostname for the server. In production mode this should be the FQDN of your server.
Contains the configuration options for the authentication.
The handler class checks if the username / password combination submitted from the client is valid.
You can provide your own handler here by extending the base handler class
If left blank, a guard handler is created using the configured guard:
The guard is only used if the handler is left blank.
The package comes with an integrated smtp guard driver. To use this driver, edit your
auth.php config file and add the guard config as follows:
'guards' => [ ... 'smtp' => [ 'driver' => 'smtp', 'username_field' => 'email', 'provider' => 'users', ], ],
The provider can be any user provider defined in your config. In this example, the default eloquent user provider is configured, with the email field as the smtp username.
This handler checks if a user can send a message to a given recipient.
By default, all recipients are allowed using the
If you only want authenticated users to be able to send messages, create a new handler implementing the
Here you can define additional options for the socket.
By default the socket is configured with the option to provide a self signed certificate for connections using tls encryption with STARTTLS.
You can find more information about the options here.
To recieve a message and handle it from there, create an event listener for the
The event contains the user (if authenticated) as well as the
To start listening for incoming connections, run the following command:
php artisan smtpd:listen
From here you can save the message to your database, send it to another server using the laravel mailer or just ignore it... ¯\_(ツ)_/¯
Copyright © 2019 Aaron Schmied schmied.dev
Contains sources of the following packages: