| 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.2 2007/07/31 23:30:15 kbahey Exp $ |
| 4 |
|
|
| 5 |
define('REROUTE_EMAIL_ADDRESS', 'reroute_email_address'); |
define('REROUTE_EMAIL_ADDRESS', 'reroute_email_address'); |
| 6 |
|
define('REROUTE_EMAIL_DEV_NULL', 'reroute_email_dev_null'); |
| 7 |
|
|
| 8 |
function reroute_email_menu($may_cache) { |
function reroute_email_menu($may_cache) { |
| 9 |
$items = array(); |
$items = array(); |
| 23 |
} |
} |
| 24 |
|
|
| 25 |
function reroute_email_settings() { |
function reroute_email_settings() { |
| 26 |
|
$form[REROUTE_EMAIL_DEV_NULL] = array( |
| 27 |
|
'#type' => 'checkbox', |
| 28 |
|
'#title' => t('Disable all mails'), |
| 29 |
|
'#default_value' => variable_get(REROUTE_EMAIL_DEV_NULL, FALSE), |
| 30 |
|
'#description' => t('Check this to disable all outgoing email from this web site.'), |
| 31 |
|
); |
| 32 |
|
|
| 33 |
$form[REROUTE_EMAIL_ADDRESS] = array( |
$form[REROUTE_EMAIL_ADDRESS] = array( |
| 34 |
'#type' => 'textfield', |
'#type' => 'textfield', |
| 35 |
'#title' => t('Email address'), |
'#title' => t('Email address'), |
| 45 |
function reroute_email_mail_alter(&$mailkey, &$to, &$subject, &$body, &$from, &$headers) { |
function reroute_email_mail_alter(&$mailkey, &$to, &$subject, &$body, &$from, &$headers) { |
| 46 |
global $base_url; |
global $base_url; |
| 47 |
|
|
| 48 |
|
if (variable_get(REROUTE_EMAIL_DEV_NULL, FALSE)) { |
| 49 |
|
return; |
| 50 |
|
} |
| 51 |
|
|
| 52 |
// Format a message to show at the top |
// Format a message to show at the top |
| 53 |
$msg = "This email was rerouted.\n"; |
$msg = "This email was rerouted.\n"; |
| 54 |
$msg .= "Web site: @site\n"; |
$msg .= "Web site: @site\n"; |