Skip to content

Instantly share code, notes, and snippets.

@jision
Created March 21, 2017 13:46
Show Gist options
  • Save jision/07880448519e086f9abea283dca6afaf to your computer and use it in GitHub Desktop.
Save jision/07880448519e086f9abea283dca6afaf to your computer and use it in GitHub Desktop.
<?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