【发布时间】:2021-08-27 11:27:50
【问题描述】:
我想从 Controller 更改环境配置,但这不起作用。
控制器
config(['MAIL_HOST' => 'smtp.sendgrid.net']);
config(['MAIL_PORT' => '25']);
config(['MAIL_USERNAME' => 'apikey']);
config(['MAIL_PASSWORD' => 'SG..']);
Mail::send(
'vendor.maileclipse.templates.news',
["content" => $content],
function ($message) use ($email) {
$message->to($email)->subject('Email');
}
);
}
.env
MAIL_DRIVER=smtp
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=xy@xy.com
MAIL_FROM_NAME="Test"
【问题讨论】:
标签: laravel email environment-variables laravel-8 laravel-7