Created
March 21, 2017 13:46
-
-
Save jision/07880448519e086f9abea283dca6afaf to your computer and use it in GitHub Desktop.
This file contains 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\Console\Commands; | |
use Illuminate\Console\Command; | |
class MailConsole extends Command | |
{ | |
/** | |
* The name and signature of the console command. | |
* | |
* @var string | |
*/ | |
protected $signature = 'mail {email_id}'; | |
/** | |
* Create a new command instance. | |
* | |
* @return void | |
*/ | |
public function __construct() | |
{ | |
parent::__construct(); | |
} | |
/** | |
* Execute the console command. | |
* | |
* @return mixed | |
*/ | |
public function handle() | |
{ | |
$arguments = $this->argument(); | |
$email_id = $arguments['email_id']; | |
try{ | |
Mail::raw('Text to e-mail', function ($message) { | |
$message->from('[email protected]', 'Laravel'); | |
$message->to('[email protected]')->cc('[email protected]'); | |
}); | |
$this->info('message send'); | |
}catch(\Exception $e){ | |
$this->error($e->getMessage()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment