Showing
1 changed file
with
35 additions
and
1 deletions
... | @@ -10,6 +10,7 @@ use Illuminate\Foundation\Bus\Dispatchable; | ... | @@ -10,6 +10,7 @@ use Illuminate\Foundation\Bus\Dispatchable; |
10 | use Illuminate\Queue\InteractsWithQueue; | 10 | use Illuminate\Queue\InteractsWithQueue; |
11 | use Illuminate\Queue\SerializesModels; | 11 | use Illuminate\Queue\SerializesModels; |
12 | use Illuminate\Support\Facades\Cache; | 12 | use Illuminate\Support\Facades\Cache; |
13 | +use Illuminate\Support\Facades\Log; | ||
13 | use Illuminate\Support\Facades\Mail; | 14 | use Illuminate\Support\Facades\Mail; |
14 | use Illuminate\Support\Facades\Redis; | 15 | use Illuminate\Support\Facades\Redis; |
15 | 16 | ||
... | @@ -43,6 +44,39 @@ class SendVerificationMessage implements ShouldQueue | ... | @@ -43,6 +44,39 @@ class SendVerificationMessage implements ShouldQueue |
43 | 44 | ||
44 | $redis->setex($this->email,1800,$code); //过期时间30分钟 | 45 | $redis->setex($this->email,1800,$code); //过期时间30分钟 |
45 | 46 | ||
46 | - Mail::to($this->email)->send(new SendVerifyCode($code)); | 47 | + |
48 | + $api = 'https://api.sendcloud.net/apiv2/mail/send'; | ||
49 | + $API_USER = 'mofunsky_noreply'; | ||
50 | + $API_KEY = '8EkR0XnMuJn6V5yQ'; | ||
51 | + $from = 'noreply@mofunsky.com'; | ||
52 | + $vars = json_encode(array( | ||
53 | + "to" => array($this->email), | ||
54 | + "sub" => array( | ||
55 | + '%code%' => array($code), | ||
56 | + ), | ||
57 | + )); | ||
58 | + $param = array( | ||
59 | + 'api_user' => $API_USER, // 使用api_user和api_key进行验证 | ||
60 | + 'api_key' => $API_KEY, | ||
61 | + 'from' => $from, // 发信人,用正确邮件地址替代 | ||
62 | + 'fromname' => 'Parlando', | ||
63 | + 'substitution_vars' => $vars, | ||
64 | + 'template_invoke_name' => 'parlando_mail_verify', | ||
65 | + 'subject' => '[Parlando] Register Verify', | ||
66 | + 'resp_email_id' => 'true' | ||
67 | + ); | ||
68 | + | ||
69 | + $data = http_build_query($param); | ||
70 | + $options = array( | ||
71 | + 'http' => array( | ||
72 | + 'method' => 'POST', | ||
73 | + 'header' => 'Content-Type: application/x-www-form-urlencoded', | ||
74 | + 'content' => $data | ||
75 | + )); | ||
76 | + $context = stream_context_create($options); | ||
77 | + $result_json = file_get_contents($api, FILE_TEXT, $context); | ||
78 | + | ||
79 | + Log::channel('daily')->debug($result_json); | ||
80 | + | ||
47 | } | 81 | } |
48 | } | 82 | } | ... | ... |
-
Please register or login to post a comment