X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/b8e2d75014c89c9e345c3f940ec8743bd158df67..refs/pull/5280/head:/app/Config/mail.php diff --git a/app/Config/mail.php b/app/Config/mail.php index abdbd382c..2906d769a 100644 --- a/app/Config/mail.php +++ b/app/Config/mail.php @@ -8,35 +8,62 @@ * Do not edit this file unless you're happy to maintain any changes yourself. */ +// Configured mail encryption method. +// STARTTLS should still be attempted, but tls/ssl forces TLS usage. +$mailEncryption = env('MAIL_ENCRYPTION', null); + return [ // Mail driver to use. + // From Laravel 7+ this is MAIL_MAILER in laravel. + // Kept as MAIL_DRIVER in BookStack to prevent breaking change. // Options: smtp, sendmail, log, array - 'driver' => env('MAIL_DRIVER', 'smtp'), - - // SMTP host address - 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), - - // SMTP host port - 'port' => env('MAIL_PORT', 587), + 'default' => env('MAIL_DRIVER', 'smtp'), // Global "From" address & name 'from' => [ - 'address' => env('MAIL_FROM', 'mail@bookstackapp.com'), - 'name' => env('MAIL_FROM_NAME', 'BookStack') + 'address' => env('MAIL_FROM', 'bookstack@example.com'), + 'name' => env('MAIL_FROM_NAME', 'BookStack'), ], - // Email encryption protocol - 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + // Mailer Configurations + // Available mailing methods and their settings. + 'mailers' => [ + 'smtp' => [ + 'transport' => 'smtp', + 'scheme' => null, + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'port' => env('MAIL_PORT', 587), + 'username' => env('MAIL_USERNAME'), + 'password' => env('MAIL_PASSWORD'), + 'verify_peer' => env('MAIL_VERIFY_SSL', true), + 'timeout' => null, + 'local_domain' => env('MAIL_EHLO_DOMAIN'), + 'tls_required' => ($mailEncryption === 'tls' || $mailEncryption === 'ssl'), + ], + + 'sendmail' => [ + 'transport' => 'sendmail', + 'path' => env('MAIL_SENDMAIL_COMMAND', '/usr/sbin/sendmail -bs'), + ], - // SMTP server username - 'username' => env('MAIL_USERNAME'), + 'log' => [ + 'transport' => 'log', + 'channel' => env('MAIL_LOG_CHANNEL'), + ], - // SMTP server password - 'password' => env('MAIL_PASSWORD'), + 'array' => [ + 'transport' => 'array', + ], - // Sendmail application path - 'sendmail' => '/usr/sbin/sendmail -bs', + 'failover' => [ + 'transport' => 'failover', + 'mailers' => [ + 'smtp', + 'log', + ], + ], + ], // Email markdown configuration 'markdown' => [ @@ -45,11 +72,4 @@ return [ resource_path('views/vendor/mail'), ], ], - - // Log Channel - // If you are using the "log" driver, you may specify the logging channel - // if you prefer to keep mail messages separate from other log entries - // for simpler reading. Otherwise, the default channel will be used. - 'log_channel' => env('MAIL_LOG_CHANNEL'), - ];