CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Is it possible to disable outgoing SMTP in the civicrm.settings.php?
Pages: [1]

Author Topic: Is it possible to disable outgoing SMTP in the civicrm.settings.php?  (Read 1236 times)

kreynen

  • I post occasionally
  • **
  • Posts: 105
  • Karma: 8
Is it possible to disable outgoing SMTP in the civicrm.settings.php?
June 22, 2013, 02:32:44 pm
I would like to disable mail on a staging sites in the civicrm.settings.php file instead of in the database so that when the database is cloned from live -> staging, it's not left for someone to remember to reset that.  Is that possible?

I found a reference to the fact that the in versions > that 4.3 all values stored in the domain table can be set in the civicrm.settings.php.  I've also found where the settings are referenced in the Admin UI, https://github.com/civicrm/civicrm-core/blob/master/CRM/Admin/Form/Setting/Smtp.php#L49 and where that's stored in the mailing_backend settings in the civicrm_settings table.

What I can't figure out is how/where values from the domain table are being overridden by the civicrm.settings.php file and if it's possible to do that for the civicrm_settings table values. 

If it's not possible, I was thinking about adding a settings to determine the live vs. staging environments in the CiviCRM Cron module and updating the mailing_backend value before running CiviCRM's cron from Drupal's cron.  Not ideal, but it would achieve the goal of not accidentally emailing thousands of users.
« Last Edit: July 25, 2013, 06:47:09 pm by kreynen »

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Is it possible to disable outgoing SMTP in the civicrm.settings.php?
June 22, 2013, 05:40:31 pm
Just uncomment this line in civicrm.settings.php

// define( 'CIVICRM_MAIL_LOG', '/var/www/sites/all/files/civicrm/templates_c/mail.log' );
Try asking your question on the new CiviCRM help site.

kreynen

  • I post occasionally
  • **
  • Posts: 105
  • Karma: 8
Re: Is it possible to disable outgoing SMTP in the civicrm.settings.php?
June 23, 2013, 05:26:54 am
Thanks.  That was REALLY easy.  Wrapping settings in civicrm.settings.php with environment check for Pantheon users...

Code: [Select]
if ( $pantheon_conf['pantheon_environment'] == 'dev' || $pantheon_conf['pantheon_environment'] == 'test' ){
      /**
      * This setting logs all emails to a file. Useful for debugging any mail (or civimail) issues.
      * This will not send any email, so ensure this is commented out in production
      */
     define( 'CIVICRM_MAIL_LOG', '/srv/bindings/' . $pantheon_conf['pantheon_binding'] . '/code/sites/default/files/civicrm/templates_c//mail.log' );
    }

https://drupal.org/node/2018769

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Is it possible to disable outgoing SMTP in the civicrm.settings.php?
June 23, 2013, 01:24:53 pm
Glad to help.
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Is it possible to disable outgoing SMTP in the civicrm.settings.php?

This forum was archived on 2017-11-26.