Search code examples
octobercmsoctobercms-pluginsoctobercms-backend

Octobercms .env vs database Mail config settings


I can set Mail credentials in the backend Mail module, and with a .env file. Which one takes precedent? Will some plugins use .env and other plugins use the database settings? If I leave the backend values blank, will the .env settings be used?


Solution

  • Database settings (System\Models\MailSetting model) are used by October CMS itself (and maybe by RainLab's plugins, but I'm not sure). 3rd party plugins can use something else, depends on creator's taste.

    If you leave the backend values blank, MailSetting model probably takes values form your config/mail.php file. If you open it, you'll see something like:

    'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
    

    It means that host resolves to MAIL_HOST parameter from .env file, and if it's not there, smtp.mailgun.org will be taken.