A simple database logger for all outgoing emails sent by Laravel website.

Overview

Laravel Email Database Log

A simple database logger for all outgoing emails sent by Laravel website.

Installation

Step 1: Composer

Laravel Email Database Log can be installed via composer by running this line in terminal:

composer require shvetsgroup/laravel-email-database-log

Step 2: Configuration

You can skip this step if your version of Laravel is 5.5 or above. Otherwise, you have to add the following to your config/app.php in the providers array:

'providers' => [
    // ...
    ShvetsGroup\LaravelEmailDatabaseLog\LaravelEmailDatabaseLogServiceProvider::class,
],

Step 3: Migration

Now, run this in terminal:

php artisan migrate

Usage

After installation, any email sent by your website will be logged to email_log table in the site's database.

Comments
  • Extract message-ID into a separate column, save attachments to storage not db, added config file

    Extract message-ID into a separate column, save attachments to storage not db, added config file

    Separate message-ID into it's own column to facilitate identifying emails.

    In my scenario I have a webhook that will ping my server when the email failed and this gives me a quick way to find in the emails_log table which email has failed.

    opened by dmcbrn 7
  • Config Settings

    Config Settings

    Hello, I just stumbled upon this as a way to log emails sent. Upon testing it seems to work perfectly. I would, however, like to see a config file where I could change the table name. In my example I name all tables as a category for easier display in PHPmyAdmin. In this case I would name it Logs__Email This way I can keep all my log tables separated and view uncluttered.

    Thank you for your consideration.

    opened by djarbz 5
  • Sending Mail With Attachment Returns DB error

    Sending Mail With Attachment Returns DB error

    Useful Package guys,

    I have used it on a few projects but having trouble with sending mails with attachments, like PDF documents since it seems to try insert the PDF into the DB.

    Sample error: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\x9C\x03\x00\x00\x00\x00...' for column 'body' at row 1.

    I have tried ->attachData() and ->attach() with no luck. PHP7.0 and Laravel 5.4

    opened by DevinNorgarb 5
  • migration file to use longtext instead of text for email_log table

    migration file to use longtext instead of text for email_log table

    I send a few mails with attached pdf documents. Unfortunately they can not get saved and are not sent. The reason is that the MySQL TEXT data type can store only 64kB of data. MEDIUMTEXT can save 16MB and LONGTEXT can store up to 4GB. So I simply changed the datatype of attachments from TEXT to LONGTEXT.

    opened by hapheus 3
  • laravel 53 publish error

    laravel 53 publish error

    This is the error I get on the command line.

     [ErrorException]
      Declaration of ShvetsGroup\LaravelEmailDatabaseLog\LaravelEmailDatabaseLogServiceProvider::boot(Illuminate\Contracts\E
      vents\Dispatcher $events) should be compatible with Illuminate\Foundation\Support\Providers\EventServiceProvider::boot
      ()
    

    Are you planning to update your package to 5.3?

    Thanks!

    opened by illuminate3 3
  • Laravel 6

    Laravel 6

    This package fails when used with Laravel 6.0.1.

    Problem 1 - Installation request for shvetsgroup/laravel-email-database-log ^1.2 -> satisfiable by shvetsgroup/laravel-email-database-log[1.2]. - Conclusion: remove laravel/framework v6.0.1 - Conclusion: don't install laravel/framework v6.0.1 - shvetsgroup/laravel-email-database-log 1.2 requires illuminate/support ~5.0 -> satisfiable by laravel/framework[5.8.x-dev], illuminate/support[5.0.x-dev, 5.1.x-dev, 5.2.x-dev, 5.3.x-dev, 5.4.x-dev, 5.5.x-dev, 5.6.x-dev, 5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9, v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.37, v5.5.39, v5.5.40, v5.5.41, v5.5.43, v5.5.44, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.4, v5.8.8, v5.8.9]. - Can only install one of: laravel/framework[5.8.x-dev, v6.0.1]. - don't install illuminate/support 5.5.x-dev|don't install laravel/framework v6.0.1 - don't install illuminate/support 5.6.x-dev|don't install laravel/framework v6.0.1 - don't install illuminate/support 5.7.17|don't install laravel/framework v6.0.1 - don't install illuminate/support 5.7.18|don't install laravel/framework v6.0.1 - don't install illuminate/support 5.7.19|don't install laravel/framework v6.0.1 - don't install illuminate/support 5.7.x-dev|don't install laravel/framework v6.0.1 - don't install illuminate/support 5.8.x-dev|don't install laravel/framework v6.0.1 - don't install illuminate/support v5.5.0|don't install laravel/framework v6.0.1 - don't install illuminate/support v5.5.16|don't install laravel/framework v6.0.1 - don't install illuminate/support v5.5.17|don't install laravel/framework v6.0.1 - don't install illuminate/support v5.5.2|don't install laravel/framework v6.0.1 - don't install illuminate/support v5.5.28|don't install laravel/framework v6.0.1 - don't install illuminate/support v5.5.33|don't install laravel/framework v6.0.1

    opened by paulwrightabuk 2
  • Instance of Swift_Mime_MimeEntity expected, received Swift_Message instance

    Instance of Swift_Mime_MimeEntity expected, received Swift_Message instance

    I'm trying to use this package to log emails in Laravel 5.5. I'm queuing my email class like so:

    $jobId = Mail::to('[email protected]')->queue(new ApiEmail($data));
    

    However, I'm getting an error:

    Argument 1 passed to ShvetsGroup\LaravelEmailDatabaseLog\EmailLogger::getMimeEntityString() must be an instance of Swift_Mime_MimeEntity, instance of Swift_Message given, called in ShvetsGroup/LaravelEmailDatabaseLog/EmailLogger.php on line 23 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Type error: Argument 1 passed to ShvetsGroup\\LaravelEmailDatabaseLog\\EmailLogger::getMimeEntityString() must be an instance of Swift_Mime_MimeEntity, instance of Swift_Message given, called in /vendor/shvetsgroup/laravel-email-database-log/src/ShvetsGroup/LaravelEmailDatabaseLog/EmailLogger.php on line 23 at /vendor/shvetsgroup/laravel-email-database-log/src/ShvetsGroup/LaravelEmailDatabaseLog/EmailLogger.php:33)
    

    Any idea why this is happening?

    opened by markdieselcore 2
  • Hebrew Subject goes wrong

    Hebrew Subject goes wrong

    When sending an email with an hebrew subject (charset is utf-8), it goes like this on the database: =?utf-8?Q?=D7=A8=D7=A9=D7=99=D7=9E=D7=AA_=D7=94=D7=A6?= =?utf-8?Q?=D7=99=D7=95=D7=93_=D7=9C=D7=9E=D7=A9=D7=97=D7=A7_=D7=A0=D7=92?= =?utf-8?Q?=D7=93_=D7=A8=D7=99=D7=90=D7=9C_=D7=9E=D7=93=D7=A8=D7=99=D7=93?= =?utf-8?Q?_=D7=A4=D7=95=D7=A8=D7=A1=D7=9E=D7=94!?=

    opened by Naxon 2
  • Break package in laravel 5.2

    Break package in laravel 5.2

    [ErrorException] Declaration of ShvetsGroup\LaravelEmailDatabaseLog\LaravelEmailDatabaseLogServiceProvider::boot() should be compatible with Illuminate\Foundation\Support\Providers\E ventServiceProvider::boot(Illuminate\Contracts\Events\Dispatcher $events)

    Pull #3 break package in laravel 5.2.

    opened by juniorb2ss 2
  • Laravel 9.x Support

    Laravel 9.x Support

    This PR will drop all support for Laravel 8.x and below and only support Laravel 9.x. Because Laravel 9.x only supports PHP 8.x and up we also drop support for any old PHP versions.

    Because Laravel switched form SwiftMailer to Symfony Mailer the implementation changed and any logged data could be saved differently, if this is the case please let me know. But i think alle should be the same. (I added some tests to have some better feedback for the future).

    opened by spaantje 1
  • Long texts needed

    Long texts needed

    Hi,

    Just wanted to advise that you should implement long texts for body and headers instead just texts, in fact that a user is using or not html emails could make fail the insert query cause too long.

    Thanks,

    opened by tommiekn 1
  • Not using laravel template

    Not using laravel template

    Since updating to the recent version of this package, emails have stopped being stored as they would be sent with the default Laravel templates. Instead, it is pretty much just raw html. Is this intentional? Is there a config to store with laravel templates?

    opened by CrisCrassus 0
  • Issue to manage the email log when multiple role user Authenticate

    Issue to manage the email log when multiple role user Authenticate

    Is there any way to add login user id or email id to identification that which user sent that mail so we can separate the different user data to display that data to particular user ?

    currently, I have to display all email log data to admin because i can't get the particular user data from email log table

    please think on it and change accordingly

    opened by parthkapatel 2
  • logging without sending

    logging without sending

    Laravel 9 Error text: stream_socket_client(): Unable to connect to <host>:587 (Operation timed out) And logged in database

    Mail::to('[email protected]')->send(new IcsNotificationShipped($obj));
    
    opened by Mishanki 0
  • change: truncate values of long string fields to database field length

    change: truncate values of long string fields to database field length

    in the email_log table, some fields (addresses and subject) have type 'string', which means laravel creates them with a default length of 255 characters.

    however, in case of many e-mails - e.g. in cc - the total length of a header can exceed this character limit. theoretically, a single e-mail address could be up to 320 characters long

    before this patch, the length limit was not checked and e-mails would not be logged. error message:

    [previous exception] [object] (PDOException(code: 22001): SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'bcc' at row 1 at /var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:115)
    [stacktrace]
    

    this patch truncates fields at 255 characters so the log entry can be created. the untruncated contents are still available in the body column.

    test code:

    Mail::send([], [], function($message) {
        $message->to('[email protected].' . str_repeat('x', 255))->subject('Test')->setBody('E-Mail'); 
    });
    
    opened by flexponsive 0
Releases(10.0.0)
Owner
Shvets Group
Shvets Group
Slim-Logger - A stand-alone logger class for use with the Slim Framework

Slim-Logger - A stand-alone logger class for use with the Slim Framework

Josh Lockhart 41 Mar 12, 2022
temperature-pi: a simple Raspberry Pi based temperature logger using a DS18B20 1-Wire digital temperature sensor, & a local sqlite database

temperature-pi temperature-pi is a simple Raspberry Pi based temperature logger using a DS18B20 1-Wire digital temperature sensor, & a local sqlite da

Ronan Guilloux 23 Dec 27, 2020
Simple PHP Logger. Composer package

Basic PHP Logger ?? Simple logger. Composer package.

null 1 Jan 28, 2022
πŸ“‘ Laravel HTTP Logger

Logging incoming HTTP requests

The Dragon Code 28 Nov 29, 2022
123Solar is a set of PHP/JS files that make a web logger to monitor your photovoltaic inverter(s)

123Solar is a set of PHP/JS files that make a web logger to monitor your photovoltaic inverter(s). It just need a web server and PHP, no databases are even needed. The philosophy is: To keep it simple, fast, with a low foot print to run on cheap and low powered devices.

null 30 Jan 6, 2023
Test Doubles for the PSR-3 Logger Interface

PSR Log Test Doubles Test Doubles for the PSR-3 Logger Interface Motivation In PHP world, most people create Test Doubles via PHPUnits mocking framewo

Jeroen De Dauw 2 Oct 7, 2022
Allows you to process logs using any PSR-3 compatible logger such as Monolog

Yii 2 PSR Log Target Allows you to process logs using any PSR-3 compatible logger such as Monolog

Alexander Makarov 67 Dec 14, 2022
ChromePhp - a PHP library for the Chrome Logger Google Chrome extension

ChromePhp - a PHP library for the Chrome Logger Google Chrome extension

Craig Campbell 1.4k Dec 30, 2022
Robust, composite logger with filtering, formatting, and PSR-3 support

laminas-log ???? Русским Π³Ρ€Π°ΠΆΠ΄Π°Π½Π°ΠΌ ΠœΡ‹, участники Laminas, Ρ€ΠΎΠ΄ΠΈΠ»ΠΈΡΡŒ ΠΈ ΠΆΠΈΠ²Π΅ΠΌ Π² Ρ€Π°Π·Π½Ρ‹Ρ… странах. Π£ ΠΌΠ½ΠΎΠ³ΠΈΡ… ΠΈΠ· нас Π΅ΡΡ‚ΡŒ Π΄Ρ€ΡƒΠ·ΡŒΡ, родствСнники ΠΈ ΠΊΠΎΠ»Π»Π΅Π³ΠΈ ΠΊΠ°ΠΊ Π²

Laminas Project 27 Nov 24, 2022
Clear all your logs in [linux/windows] servers πŸ›‘οΈ

Log-killer Log Killer is tool for [Linux/Windows] Servers This tool will delete all your logs just download the tool and run it on the server if your

Rizer 281 Nov 24, 2022
CakePHP3: plugin that facilitates versioned database entities

Version A CakePHP 4.x plugin that facilitates versioned database entities Installation Add the following lines to your application's composer.json: "r

Jose Diaz-Gonzalez 52 Sep 3, 2022
A simple and beautiful laravel log reader

Laravel Log Reader A simple and beautiful laravel log reader Documentation Get full documentation of Laravel Log Reader Other Packages Laravel H - A h

Md.Harun-Ur-Rashid 356 Dec 30, 2022
A Simple Logging Class For PHP

KLogger: Simple Logging for PHP A project written by Kenny Katzgrau and Dan Horrigan. About KLogger is an easy-to-use PSR-3 compliant logging class fo

Kenny Katzgrau 964 Dec 11, 2022
PHP logging library that is highly extendable and simple to use.

Analog - Minimal PHP logging library Copyright: (c) 2012-Present Johnny Broadway License: MIT A minimal PHP logging package based on the idea of using

Aband*nthecar 331 Dec 21, 2022
AcLog is a simple, zero-dependency PHP package to log activity to files

AcLog is a simple, zero-dependency PHP package to log activity to files. This is not meant for logging errors, this is can be used for logging c

null 2 Sep 9, 2022
Keep your laravel logs small and tidy.

Logs can get quite out of hand. This package helps save server space and keep your Laravel log files small.

Accent Interactive 73 Nov 14, 2022
This package is for centralized logging of multiple Laravel application into one connection.

Laralogs This package is for centralized logging of multiple Laravel application into one connection. Installation You can install the package via com

Remon 4 Apr 26, 2022
Small package that can helps in debugging with API logs for Laravel Project.

Rest APIs Logger This is a small package that can helps in debugging with API logs. Installation Install the package via composer composer require tfs

Sunny Mahajan 7 Aug 31, 2022
Log Laravel application request and response with a unique ID for easy debugging

Flexible and extendable logging of Laravel application request and responses Zero configuration logging of Requests and Responses to database or custo

Bilfeldt 37 Nov 6, 2022