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) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail »
  • Using CiviSMTP (Moderator: shane) »
  • Looking at a proposed hook designed to work with CiviSMTP
Pages: [1]

Author Topic: Looking at a proposed hook designed to work with CiviSMTP  (Read 645 times)

torenware

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 4
Looking at a proposed hook designed to work with CiviSMTP
February 23, 2013, 12:06:15 am
I'm working on a fairly exotic AWS deploy of CiviMail.  One thing we've wanted to do for a while is to use Micah Lee's postfix forwarder idea for outgoing CiviMails.  By using postfix's store-and-forward capabilities, it looks like outgoing mail can be made considerably more reliable.

The problem is that we can't upgrade all of our deploys at once, and we need to test store-and-forward on some of our deploys that share settings with our non-upgradeable deploys.

The solution for this turns out to be a new hook, described in CRM-11958 (http://issues.civicrm.org/jira/browse/CRM-11958).  Here's a sample implementation:
Code: [Select]
<?php
/**
 * This hook can modify the settings used to initialize the Mailer
 * object used for outgoing mail for CiviCRM.
 *
 * In our example here, we use the hook to handle a custom Postfix forwarder
 * as recommended for CiviSMTP.  In our use case here, the default case is to
 * talk to CiviSMTP directly; we check for special settings that indicate our
 * local install should instead talk to our Postfix forwarder at port 10999.
 *
 * @param string $driver
 *   The Mailer driver class to use.
 * @param array $params
 *   An array of outgoing mail backend items.
 *
 * @see http://pear.php.net/manual/en/package.mail.mail.factory.php
 * 
 */
function civitest_civicrm_alterOutgoingMailParams(&$driver, &$params) {
  global 
$g_custom_settings;
  if (!empty(
$g_custom_settings['CUSTOM_CIVIMAIL_USE_POSTFIX_FORWARDER'])) {
    
$params['auth'] = FALSE;
    
$params['host'] = '127.0.0.1';
    
$params['port'] = 10999;
    unset(
$params['username']);
    unset(
$params['password']);
  }
}

?>


If this hook solves any problems for you, I encourage you to vote for the issue, so that it gets into a version not too far off.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail »
  • Using CiviSMTP (Moderator: shane) »
  • Looking at a proposed hook designed to work with CiviSMTP

This forum was archived on 2017-11-26.