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) »
  • best way to redirect email on test server
Pages: [1]

Author Topic: best way to redirect email on test server  (Read 718 times)

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
best way to redirect email on test server
June 18, 2012, 02:35:29 am
Hey there,

We have a test server that we don't really always want emails to be sent from.  I'm wondering what the best way to do this on a global level is.  We have access to postfix config so I am thinking we could probably write a rewrite rule that just sends them all a google apps address so that email from info@client.org.uk to supporter@gmail.com gets directed to test+supporter+gmail.com@thirdsectordesign.org or something similar.

And we could maybe set up specific rules for particular clients so if they want, so that email from info@sophisticated-client.org.uk to supporter@gmail.com gets directed to test+supporter+gmail.com@sophisticated-client.org.uk

The advantage of this is that we don't have to worry about the multitude of different ways that email can get sent out from the system: drupal civicrm, etc. and since we always use a local mail server it would work.

Appreciate that this might be more of a postfix question than an civicrm question and maybe i'll just need to read http://www.postfix.org/ADDRESS_REWRITING_README.html but experience, ideas, etc. appreciated.

Michael
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: best way to redirect email on test server
June 18, 2012, 07:50:45 am

1. drupal has a mail redirect module

2. You can probably extend that module and also implement the civicrm hook alterMailParams

3. CiviCRM has a defined constant where u can redirect all mail to a file system (or /dev/null)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: best way to redirect email on test server
June 18, 2012, 12:37:20 pm
hey lobo,

thanks for the input.  i did think about those options but but IMO  the problem with them is that they introduce lots of steps that you have to remember with each site that you set up, install the modules, edit your civicrm settings files. plus there is always the chance that some random module doesn't obey the rules that you have set up.

It seemed to me that since I can control the test server, I could just add the config to postfix and then no emails would get sent out ever.

Having said that, if I did do 2, it would only be one step to remember for each site. but still that is one step more than none.

PS. it seems like the best way to implement mail redirect would be to be redirect all mail by default and then turn off mail_redirect in the production environment, so that whenever you make another environment, email is redirected by default.  That is what mr felton's (very cool and useful) http://drupal.org/project/environment_indicator module does.
Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • best way to redirect email on test server

This forum was archived on 2017-11-26.