Browse Source

mail模版变更目录

visuddhinanda 2 years ago
parent
commit
5f2d47b66d

+ 51 - 0
app/Console/Commands/TestSendMail.php

@@ -0,0 +1,51 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+use Mail;
+use App\Mail\InviteMail;
+use Illuminate\Support\Str;
+
+class TestSendMail extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'test:send.mail';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return int
+     */
+    public function handle()
+    {
+        $uuid = Str::uuid();
+        Mail::to("visuddhinanda@gmail.com")
+            ->send(new InviteMail($uuid,'zh-Hans'));
+        if(Mail::failures()){
+            $this->error('send email fail');
+        }
+        return 0;
+    }
+}

+ 0 - 1
app/Http/Controllers/InviteController.php

@@ -77,7 +77,6 @@ class InviteController extends Controller
 
         $uuid = Str::uuid();
         Mail::to($request->get('email'))
-            ->locale(strtolower($request->get('lang')))
             ->send(new InviteMail($uuid,strtolower($request->get('lang'))));
         if(Mail::failures()){
             return $this->error('send email fail',[],200);

+ 1 - 1
app/Mail/InviteMail.php

@@ -33,7 +33,7 @@ class InviteMail extends Mailable
      */
     public function build()
     {
-        return $this->view('emails.invite_'.$this->lang)
+        return $this->view('emails.invite.'.$this->lang)
                     ->with([
                         'url' => env('APP_URL').'/anonymous/users/sign-up/'.$this->uuid,
                     ]);

+ 12 - 0
resources/views/emails/invite/en.blade.php

@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>invite</title>
+</head>
+<body>
+<div>wikipali 注册邀请</div>
+<div>点击此链接注册wikipali账号。此链接邀请只可以注册一个账户。有效期7天。</div>
+<a href='{{ $url }}'>{{ $url }}</a><br>
+<div>此邮件为系统自动发送,请勿回复。</div>
+</body>
+</html>

+ 13 - 0
resources/views/emails/invite/zh-Hans.blade.php

@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>invite</title>
+    </head>
+<body>
+<div>wikipali 注册邀请</div>
+<div>点击此链接注册wikipali账号。此链接邀请只可以注册一个账户。有效期7天。</div>
+<div>{{ $url }}</div>
+<a href='{{ $url }}'>{{ $url }}</a></div>
+<div>此邮件为系统自动发送,请勿回复。</div>
+</body>
+</html>

+ 0 - 12
resources/views/emails/invite_en.blade copy.php

@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>invite</title>
-</head>
-<body>
-wikipali 注册邀请
-点击此链接注册wikipali账号。此链接邀请只可以注册一个账户。有效期7天。
-<a href='{{ $url }}'>{{ $url }}</a><br>
-此邮件为系统自动发送,请勿回复。
-</body>
-</html>

+ 0 - 12
resources/views/emails/invite_zh-Hans.php

@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<html>
-    <head>
-        <title>invite</title>
-</head>
-<body>
-wikipali 注册邀请
-点击此链接注册wikipali账号。此链接邀请只可以注册一个账户。有效期7天。
-<a href='{{ $url }}'>{{ $url }}</a><br>
-此邮件为系统自动发送,请勿回复。
-</body>
-</html>