mail: smtp config gui

This commit is contained in:
Tokumeikoi 2020-08-22 14:28:47 +08:00
parent ce8652fe20
commit 8c65a7d20e
3 changed files with 18 additions and 8 deletions

View File

@ -57,7 +57,7 @@ class ConfigSave extends FormRequest
'stripe_sk_live' => '',
'stripe_pk_live' => '',
'stripe_webhook_key' => '',
'stripe_currency' => 'in:hkd,usd,sgd,eur,gbp,jpy',
'stripe_currency' => 'in:hkd,usd,sgd,eur,gbp,jpy,cad',
// bitpayx
'bitpayx_name' => '',
'bitpayx_enable' => 'in:0,1',

View File

@ -7,6 +7,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Mail;
use App\Models\MailLog;
@ -34,6 +35,15 @@ class SendEmailJob implements ShouldQueue
*/
public function handle()
{
if (config('v2board.email_host')) {
Config::set('mail.host', config('v2board.email_host', env('mail.host')));
Config::set('mail.port', config('v2board.email_port', env('mail.port')));
Config::set('mail.encryption', config('v2board.email_encryption', env('mail.encryption')));
Config::set('mail.username', config('v2board.email_username', env('mail.username')));
Config::set('mail.password', config('v2board.email_password', env('mail.password')));
Config::set('mail.from.address', config('v2board.email_from_address', env('mail.from.address')));
Config::set('mail.from.name', config('v2board.app_name', 'V2Board'));
}
$params = $this->params;
$email = $params['email'];
$subject = $params['subject'];

View File

@ -29,7 +29,7 @@ return [
|
*/
'host' => env('MAIL_HOST', config('v2board.email_host')),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
/*
|--------------------------------------------------------------------------
@ -42,7 +42,7 @@ return [
|
*/
'port' => env('MAIL_PORT', config('v2board.email_port', 587)),
'port' => env('MAIL_PORT', 587),
/*
|--------------------------------------------------------------------------
@ -56,8 +56,8 @@ return [
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', config('v2board.email_from_address')),
'name' => env('MAIL_FROM_NAME', config('v2board.email_from_address')),
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
/*
@ -71,7 +71,7 @@ return [
|
*/
'encryption' => env('MAIL_ENCRYPTION', config('v2board.email_encryption')),
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
@ -84,9 +84,9 @@ return [
|
*/
'username' => env('MAIL_USERNAME', config('v2board.email_username')),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD', config('v2board.email_password')),
'password' => env('MAIL_PASSWORD'),
/*
|--------------------------------------------------------------------------