PHP code example of adrashyawarrior / laravel-multi-mailer
1. Go to this page and download the library: Download adrashyawarrior/laravel-multi-mailer 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/ */
adrashyawarrior / laravel-multi-mailer example snippets
namespace App\Http\Controllers;
use Adrashyawarrior\LaravelMultiMailer\LaravelMultiMailer;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Facades\Log;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
public function sendmail()
{
try {
$mailer = new LaravelMultiMailer();
$mailer->from('[email protected]', 'Shaiva Sh');
$mailer->to(['[email protected]']);
$mailer->cc(['[email protected]']);
$mailer->bcc(['[email protected]']);
$mailer->subject('Testing New Package');
$mailer->html('<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>This is a testing mail.</h1>
</body>
</html>');
$response = $mailer->send();
return response()->json($response);
} catch (\Exception $e) {
Log::info($e->getMessage());
return response('Error');
}
}
}