Is it possible to store the outbound mail settings in civicrm.settings.php? SMTP server IP address, port, user...
-
If you can provide a few more details on why you want to do this, I might be able to be of more help and expand on my answer below.– michaelmcandrewCommented Nov 10, 2017 at 9:54
-
The reason is that depending on where the site is deployed (live, staging, local machine) other outbound mail settings should be defined.– AlainBCommented Nov 10, 2017 at 11:55
-
Another approach is to use the API to edit the settings as part of a clone to staging / local machine script.– michaelmcandrewCommented Nov 10, 2017 at 13:50
2 Answers
In civicrm.settings.php
global $civicrm_setting; $civicrm_setting['Mailing Preferences']['mailing_backend'] = [ 'outBound_option' => 0, 'smtpServer' => 'localhost', 'smtpPort' => 1025, 'smtpAuth' => false ];
No. Outbound mail settings are typically configured here: civicrm/admin/setting/smtp. They can't be overridden in civicrm.settings.php apart from to disable them completely by defining CIVICRM_MAIL_LOG, e.g.
define('CIVICRM_MAIL_LOG', '/var/log/civicrm_mail');
or
define('CIVICRM_MAIL_LOG', '/dev/null');
If you aren't interested in them.