0
我使用vue.js
作爲我的前端和流明作爲我的api服務。現在我需要從流明發送電子郵件。這是我爲此做的。發送電子郵件從流明
.ENV文件
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=********@gmail.com
MAIL_PASSWORD=**********
MAIL_FROM_ADDRESS=******@gmail.com
MAIL_FROM_NAME=Sample Email App
MAIL_ENCRYPTION=tls
,然後編輯的文件bootstrap\app.php
和未註釋以下行。
$app->register(App\Providers\AppServiceProvider::class);
$app->withFacades();
Dotenv::load(__DIR__.'/../');
$app->withEloquent();
在控制器中,我用下面的代碼
use Illuminate\Support\Facades\Mail;
private function sendActivationEmail($email = null){
$email_sent = false;
if($email != null){
// send email
Mail::raw('Raw string email', function($msg) {
$msg->to(['[email protected]']); $msg->from(['[email protected]']);
});
}
return $email_sent;
}
不幸的是,這是行不通的。誰能告訴我我錯了哪裏?
不幸的是,沒有工作... '[20 17-10-20 18:55:25] lumen.ERROR:Symfony \ Component \ Debug \ Exception \ FatalThrowableError:Class'Illuminate \ Mail \ MailServiceProvider'找不到/ api/vendor/laravel/lumen-framework/src/Application .php:164 堆棧跟蹤: #0 /api/bootstrap/app.php(267):Laravel \ Lumen \ Application-> register('Illuminate \\ Mail ...')' –