-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSendEmailJob.php
More file actions
49 lines (43 loc) · 1.4 KB
/
Copy pathSendEmailJob.php
File metadata and controls
49 lines (43 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Mail\SimpleHtmlEmail;
use Mail;
class SendEmailJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $param_to;
protected $param_name;
protected $param_message;
protected $param_subject;
protected $config;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($param_to,$param_name,$param_message,$param_subject,$config=null)
{
$this->param_to = $param_to;
$this->param_name = $param_name;
$this->param_message = $param_message;
$this->param_subject = $param_subject;
$this->config = $config;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
if(isset($this->config['mail'])) config(['mail'=>$this->config['mail']]);
if(isset($this->config['app'])) config(['app'=>$this->config['app']]);
Mail::to($this->param_to)->send(new SimpleHtmlEmail($this->param_name,$this->param_message,$this->param_subject,$this->config));
}
}