PHP code example of cleaniquecoders / mailhistory

1. Go to this page and download the library: Download cleaniquecoders/mailhistory library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cleaniquecoders / mailhistory example snippets




namespace App\Mail;

use CleaniqueCoders\MailHistory\Concerns\InteractsWithMailMetadata;

class DefaultMail extends Mailable
{
    use InteractsWithMailMetadata, SerializesModels;

public function __construct()
{
    $this->configureMetadataHash();
}

use CleaniqueCoders\MailHistory\Concerns\InteractsWithMail;

class DefaultNotification extends Notification
{
    use InteractsWithMail;

public function __construct()
{
    $this->setMail(
        new \App\Mails\DefaultMail
    );
}

/**
 * Get the mail representation of the notification.
 */
public function toMail(object $notifiable): Mailable
{
    return $this->getMail()->to($notifiable->email);
}
bash
php artisan vendor:publish --tag="mailhistory-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="mailhistory-config"
bash
php artisan mailhistory:clear
bash
php artisan mailhistory:test [email protected] --mail
php artisan mailhistory:test [email protected] --notification
bash
php artisan mailhistory:test [email protected] --mail --queue=mail