Created
May 5, 2020 11:03
-
-
Save deepak-cotocus/3046940457de574b59be835a265478f3 to your computer and use it in GitHub Desktop.
Using Mail class of Laravel for sending a mail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Http\Controllers; | |
use Mail; | |
use Illuminate\Http\Request; | |
use App\Mail\TestEmailSender; | |
use Illuminate\Support\Facades\Log; | |
class TestController extends Controller | |
{ | |
public $name; | |
public $email; | |
public function __construct() | |
{} | |
public function sendEmail() | |
{ | |
$this->name = "Deepak"; | |
$this->email = "[email protected]"; | |
log::info("I am inside TestController->sendEmail()"); | |
$emailParams = new \stdClass(); | |
$emailParams->usersName = $this->name; | |
$emailParams->usersEmail = $this->email; | |
$emailParams->subject = "activate user of Demo-app - Activation Code"; | |
Mail::to($emailParams->usersEmail)->send(new TestEmailSender($emailParams)); | |
} | |
public function test(){ | |
$this->sendEmail(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment