1. Go to this page and download the library: Download sendmail/logs 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/ */
sendmail / logs example snippets
'providers' => ServiceProvider::defaultProviders()->merge([
/*
* Package Service Providers...
*/
/*
* Application Service Providers...
*/
...
Email\Logs\EmailLogServiceProvider::class
...
])->toArray(),
namespace App\Jobs;
use App\Mail\SendMailTest;
use Email\Logs\EmailLogEvent;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Mail;
class JobSendEmailTest implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $data;
/**
* Create a new job instance.
*/
public function __construct($data)
{
$this->data = $data;
}
/**
* Execute the job.
*/
public function handle(): void
{
try {
$mailable = new SendMailTest($this->data);
Mail::to("[email protected]")->send($mailable);
event(new EmailLogEvent("[email protected]", $this->data['title'] ?? "", $this->data['body'] ?? "", 'success'));
} catch (\Exception $e) {
event(new EmailLogEvent("[email protected]", $this->data['title'] ?? "", $this->data['body'] ?? "", 'failure', $e->getMessage()));
}
}
}