当我在运行Laravel 5.8的网站上注册用户时,未向用户发送欢迎电子邮件和验证电子邮件,但是当我从“重置密码”页面检查重置密码邮件时,效果很好。
这是我的ActivationMailClient.php
<?php
namespace App\Mail;
use App\Helpers\Themes;
use App\Models\Setting;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class ActivationClientMail extends Mailable
{
use Queueable, SerializesModels;
protected $user;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$crypt_email = bcrypt($this->user->email);
return $this->view('emails.active_account')
->subject('Activation - Active Account')
->to($this->user->email, $this->user->first_name . ' ' . $this->user->last_name)
->from('contact@trvtour.com', 'mywebsiteName Activation')
->with([
'crypt_email' => $crypt_email,
'user' => $this->user,
'first_name' => $this->user->first_name,
'reset_link' => url('active_account?key=' . $crypt_email . '&u=' . $this->user->id),
'site_name' => Setting::getByKey('site_name')->value
]);
}
}
这是我的ResetPassword.php
<?php
namespace App\Mail;
use App\Helpers\Themes;
use App\Models\Setting;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class ResetPassword extends Mailable
{
use Queueable, SerializesModels;
protected $user;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
$crypt_email = Themes::myCrypt($this->user->email);
return $this->view('emails.reset_password')
->to($this->user->email, $this->user->first_name . ' ' . $this->user->last_name)
->from('contact@trvtour.com', 'mywebsiteName Reset Password')
->with([
'crypt_email' => $crypt_email,
'user' => $this->user,
'reset_link' => url('panel/update_password/' . $crypt_email),
'site_name' => Setting::getByKey('site_name')->value
]);
}
}
我已经清除了我的laravel应用程序的缓存,但是问题仍然存在,请您帮我解决这个问题?
我的.env文件
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=myemail@gmail.com
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=tls