/[drupal]/contributions/modules/reroute_email/reroute_email.module
ViewVC logotype

Diff of /contributions/modules/reroute_email/reroute_email.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.4, Wed Aug 1 01:05:11 2007 UTC revision 1.5, Tue Aug 21 19:50:21 2007 UTC
# Line 1  Line 1 
1  <?php  <?php
2    
3  // $Id: reroute_email.module,v 1.1.2.2 2007/07/31 23:30:15 kbahey Exp $  // $Id: reroute_email.module,v 1.1.2.4 2007/08/21 18:42:01 kbahey Exp $
4    
5  define('REROUTE_EMAIL_ADDRESS',  'reroute_email_address');  define('REROUTE_EMAIL_ADDRESS',  'reroute_email_address');
 define('REROUTE_EMAIL_DEV_NULL', 'reroute_email_dev_null');  
6    
7  function reroute_email_menu($may_cache) {  function reroute_email_menu($may_cache) {
8    $items = array();    $items = array();
# Line 23  function reroute_email_menu($may_cache) Line 22  function reroute_email_menu($may_cache)
22  }  }
23    
24  function reroute_email_settings() {  function reroute_email_settings() {
   $form[REROUTE_EMAIL_DEV_NULL] = array(  
     '#type'          => 'checkbox',  
     '#title'         => t('Disable all mails'),  
     '#default_value' => variable_get(REROUTE_EMAIL_DEV_NULL, FALSE),  
     '#description'   => t('Check this to disable all outgoing email from this web site.'),  
   );  
   
25    $form[REROUTE_EMAIL_ADDRESS] = array(    $form[REROUTE_EMAIL_ADDRESS] = array(
26      '#type'          => 'textfield',      '#type'          => 'textfield',
27      '#title'         => t('Email address'),      '#title'         => t('Email address'),
# Line 45  function reroute_email_settings() { Line 37  function reroute_email_settings() {
37  function reroute_email_mail_alter(&$mailkey, &$to, &$subject, &$body, &$from, &$headers) {  function reroute_email_mail_alter(&$mailkey, &$to, &$subject, &$body, &$from, &$headers) {
38    global $base_url;    global $base_url;
39    
   if (variable_get(REROUTE_EMAIL_DEV_NULL, FALSE)) {  
     return;  
   }  
   
40    // Format a message to show at the top    // Format a message to show at the top
41    $msg  = "This email was rerouted.\n";    $msg  = "This email was rerouted.\n";
42    $msg .= "Web site: @site\n";    $msg .= "Web site: @site\n";
# Line 59  function reroute_email_mail_alter(&$mail Line 47  function reroute_email_mail_alter(&$mail
47    // Prepend to the body of the email    // Prepend to the body of the email
48    $body = t($msg, array('@site' => $base_url, '@to' => $to, '@key' => $mailkey)) . $body;    $body = t($msg, array('@site' => $base_url, '@to' => $to, '@key' => $mailkey)) . $body;
49    
50    // Now change the $to address to be the one we defined    // Change the $to address to be the one we defined
51    $to = variable_get(REROUTE_EMAIL_ADDRESS, ini_get('sendmail_from'));    $to = variable_get(REROUTE_EMAIL_ADDRESS, ini_get('sendmail_from'));
52  }  }
53    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.2