PHP Classes

Laravel Local Email Sender: Send email messages to logs that can be viewed

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 32 All time: 11,078 This week: 74Up
Version License PHP version Categories
laravel-local-mailer 1.0MIT/X Consortium ...8Email, Debug, Logging, Testing, PHP 8
Description 

Author

This package can send email messages to logs that can be viewed.

It provides a local mailer transport class compatible with actual mailer transport classes that can send messages to real mail addresses, except that messages are sent to local log files.

The package also provides a Web-based user interface that lets developers view the messages sent to local mailer logs.

Innovation Award
PHP Programming Innovation award nominee
September 2023
Number 6
When a developer is working on a version of an application on his development computer, he may need to send email messages as part of the functionality of the applications.

Usually, development computers are inside a restricted network like a company office or a home office network.

Therefore, email messages cannot be delivered to remote addresses due to the restrictions of those networks.

Still, when the developer needs to test the email messages the application sends, he needs at least to view the messages sent by the application he is developing.

This package provides an alternative solution. It provides a local mailer service that developers can use in Laravel applications.

Instead of sending messages to a remote mail server, it sends messages to local log files. This way, developers can see the messages sent to the log files using a Web user interface also provided by this package.

Manuel Lemos
Picture of Andrey Iatsenko
  Performance   Level  
Name: Andrey Iatsenko <contact>
Classes: 11 packages by
Country: Russian Federation Russian Federation
Age: 29
All time rank: 4243117 in Russian Federation Russian Federation
Week rank: 170 Up9 in Russian Federation Russian Federation Up
Innovation award
Innovation award
Nominee: 7x

Documentation

Local mailer for laravel

Packagist Version GitHub Workflow Status Coverage License Packagist Downloads Packagist Downloads

Each developer needs to check the sending of email messages during development. Most of them have their own ways - usage gmail, Mailtrap, laravel logs, etc.

This solution will create its own mail transport, saving emails as daily logs, with the ability to view!

image

:scroll: Installation

The package can be installed via composer:

composer require yzen.dev/laravel-local-mailer

In the config config/mail.php add a new transport:

return [
    //...
    'mailers' => [
        //...
        'local-mailer' => [
            'transport' => 'local-mailer'
        ],
    ]
]

Now you can include this transport in the env:

MAIL_MAILER=local-mailer

The page for viewing is available at `{HOST}/local-mailer`. Here you can view the log for any date. For each log, the full email will be displayed - the title, to, contents of the letter (html page), attached files, etc.

image


  Files folder image Files (39)  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (6 files, 5 directories)
Files folder imagetests (1 file, 3 directories)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file phpcs.xml Data Auxiliary data
Accessible without login Plain text file phpstan.neon Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (39)  /  .github  
File Role Description
Files folder imageworkflows (2 files)

  Files folder image Files (39)  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file code-analyze.yml Data Auxiliary data
  Accessible without login Plain text file tests.yml Data Auxiliary data

  Files folder image Files (39)  /  src  
File Role Description
Files folder imageconfig (1 file)
Files folder imageContract (2 files)
Files folder imageHttp (2 directories)
Files folder imageParser (2 files)
Files folder imageviews (4 files, 1 directory)
  Plain text file Filesystem.php Class Class source
  Plain text file LocalMailerService.php Class Class source
  Plain text file LocalMailerTransport.php Class Class source
  Plain text file MailerLogger.php Class Class source
  Plain text file RouteServiceProvider.php Class Class source
  Plain text file ServiceProvider.php Class Class source

  Files folder image Files (39)  /  src  /  config  
File Role Description
  Accessible without login Plain text file local-mailer.php Aux. Auxiliary script

  Files folder image Files (39)  /  src  /  Contract  
File Role Description
  Plain text file FilesystemContract.php Class Class source
  Plain text file MailLoggerContract.php Class Class source

  Files folder image Files (39)  /  src  /  Http  
File Role Description
Files folder imageControllers (2 files)
Files folder imageResources (1 file)

  Files folder image Files (39)  /  src  /  Http  /  Controllers  
File Role Description
  Plain text file LocalMailerController.php Class Class source
  Plain text file LocalMailerResourceController.php Class Class source

  Files folder image Files (39)  /  src  /  Http  /  Resources  
File Role Description
  Plain text file MailResources.php Class Class source

  Files folder image Files (39)  /  src  /  Parser  
File Role Description
  Plain text file Mail.php Class Class source
  Plain text file MailParser.php Class Class source

  Files folder image Files (39)  /  src  /  views  
File Role Description
Files folder imagecss (1 file)
  Accessible without login Plain text file dashboard.blade.php Aux. Auxiliary script
  Accessible without login Plain text file mails.blade.php Aux. Auxiliary script
  Accessible without login Plain text file not-found.blade.php Aux. Auxiliary script
  Accessible without login Plain text file _template.blade.php Aux. Auxiliary script

  Files folder image Files (39)  /  src  /  views  /  css  
File Role Description
  Accessible without login Plain text file styles.css Data Auxiliary data

  Files folder image Files (39)  /  tests  
File Role Description
Files folder imageE2E (2 directories)
Files folder imageFeature (2 files)
Files folder imageMails (3 files)
  Plain text file TestCase.php Class Class source

  Files folder image Files (39)  /  tests  /  E2E  
File Role Description
Files folder imageLocalMailerController (4 files)
Files folder imageLocalMailerResourceController (1 file)

  Files folder image Files (39)  /  tests  /  E2E  /  LocalMailerController  
File Role Description
  Plain text file DownloadLogTest.php Class Class source
  Plain text file IndexTest.php Class Class source
  Plain text file RemoveLogTest.php Class Class source
  Plain text file ShowByDateTest.php Class Class source

  Files folder image Files (39)  /  tests  /  E2E  /  LocalMailerResourceController  
File Role Description
  Plain text file IndexTest.php Class Class source

  Files folder image Files (39)  /  tests  /  Feature  
File Role Description
  Plain text file SendAttachedFilesTest.php Class Class source
  Plain text file TransportTest.php Class Class source

  Files folder image Files (39)  /  tests  /  Mails  
File Role Description
  Accessible without login Plain text file example.txt Data Example message
  Plain text file TextMailTest.php Class Class source
  Plain text file TextMailWithAttachedFilesTest.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:32
This week:0
All time:11,078
This week:74Up