李帅

1.集成邮件发送

...@@ -50,3 +50,5 @@ PUSHER_APP_CLUSTER=mt1 ...@@ -50,3 +50,5 @@ PUSHER_APP_CLUSTER=mt1
50 50
51 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 51 MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
52 MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 52 MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
53 +
54 +SENDGRID_API_KEY=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
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -44,8 +44,7 @@ class SendVerificationMessage implements ShouldQueue ...@@ -44,8 +44,7 @@ class SendVerificationMessage implements ShouldQueue
44 44
45 $redis->setex($this->email,1800,$code); //过期时间30分钟 45 $redis->setex($this->email,1800,$code); //过期时间30分钟
46 46
47 - 47 + /*$api = 'http://api.sendcloud.net/apiv2/mail/sendtemplate';
48 - $api = 'http://api.sendcloud.net/apiv2/mail/sendtemplate';
49 $API_USER = 'mofunsky_noreply'; 48 $API_USER = 'mofunsky_noreply';
50 $API_KEY = '8EkR0XnMuJn6V5yQ'; 49 $API_KEY = '8EkR0XnMuJn6V5yQ';
51 $from = 'noreply@yiyan.pub'; 50 $from = 'noreply@yiyan.pub';
...@@ -81,7 +80,21 @@ class SendVerificationMessage implements ShouldQueue ...@@ -81,7 +80,21 @@ class SendVerificationMessage implements ShouldQueue
81 80
82 // 用开发模板发送。 81 // 用开发模板发送。
83 Mail::to($this->email)->send(new SendVerifyCode($code)); 82 Mail::to($this->email)->send(new SendVerifyCode($code));
83 + }*/
84 +
85 + $email = new \SendGrid\Mail\Mail();
86 + $email->setFrom("hello@parlando.ink", "Parlando");
87 + $email->addTo($this->email, "Parlando User");
88 + $email->addContent(
89 + "text/html", "Please enter in the verification code input box: <strong>$code</strong><br/>(The code will expire in 30 minutes.)"
90 + );
91 + $sendgrid = new \SendGrid(env('SENDGRID_API_KEY'));
92 + try {
93 + $sendgrid->send($email);
94 + } catch (\Exception $e) {
95 + Log::channel("daily")->error("send email error :".$e->getMessage());
84 } 96 }
85 97
98 +
86 } 99 }
87 } 100 }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
18 "laravel/sanctum": "^2.11", 18 "laravel/sanctum": "^2.11",
19 "laravel/socialite": "^5.2", 19 "laravel/socialite": "^5.2",
20 "laravel/tinker": "^2.5", 20 "laravel/tinker": "^2.5",
21 + "sendgrid/sendgrid": "~7",
21 "socialiteproviders/apple": "^5.0", 22 "socialiteproviders/apple": "^5.0",
22 "socialiteproviders/facebook": "^4.1", 23 "socialiteproviders/facebook": "^4.1",
23 "socialiteproviders/github": "^4.1", 24 "socialiteproviders/github": "^4.1",
......
This diff is collapsed. Click to expand it.