It would be nice if there was an option to turn off the prepended message. Especially in HTML mail, the message might mess up the eventual output. When showcasing a website to clients they want to see the exact message that was sent out, any additional text can confuse them.

Instead of the prepended message, an additional e-mail header can be added so this info is still available. Also bcc and cc addresses should go into custom e-mail headers so they can be read while developing.

Comments

cyberwolf’s picture

Status: Active » Needs review
StatusFileSize
new4.2 KB

Attaching a patch for the D6 branch.

zilverdistel’s picture

subscribing

zilverdistel’s picture

Status: Needs review » Needs work
+++ b/reroute_email.moduleundefined
@@ -34,13 +36,20 @@ function reroute_email_settings() {
+    '#default_value' => variable_get(REROUTE_EMAIL_ENABLE_MESSAGE, 1),
+    '#description' => t('Check this box if you want a message to be prepended to the email body when the mail was rerouted.'),
+  );

I'd use "... when the mail is being rerouted."

+++ b/reroute_email.moduleundefined
@@ -65,36 +74,41 @@ function reroute_email_mail_alter(&$message) {
-    if (in_array($to, $addresslist)) {
-      // To address is in the pass-through list, let it pass through
-      $message['to'] = $to;
-    }
-    else {
+    if (!in_array($to, $addresslist)) {
       // Not on the list, so reroute to the first address in the list

I'm not sure why this has to be changed? Won't this prevent passing through the e-mails to addresses in the pass-through list?

cyberwolf’s picture

Status: Needs work » Needs review
StatusFileSize
new4.2 KB

I changed the description as you suggested.

The current code inside the conditional if (in_array($to, $addresslist)) is actually useless, as $message['to'] already equals $to. As a bit earlier you find this code:

$to = isset($message['to']) ? $message['to'] : t('<to> is missing');

So there is no reason to set it again. That's why I removed that part.

zilverdistel’s picture

Status: Needs review » Reviewed & tested by the community
adamgerthel’s picture

What does this alter exactly? The best thing would be the ability to turn on / off the reroute message via a checkbox @ admin/config/development/reroute_email

Would love that in D7 as well.

cyberwolf’s picture

The best thing would be the ability to turn on / off the reroute message via a checkbox @ admin/config/development/reroute_email

It does exactly that! Additionally, it adds some extra e-mail headers so you are still able to identify where the mail was actually intended to go:

  • X-Rerouted-Mail-Key
  • X-Rerouted-Website
  • X-Rerouted-Original-Bcc
  • X-Rerouted-Original-Cc
  • X-Rerouted-Original-To
adamgerthel’s picture

It does exactly that!

Nice! The only thing missing is that it gets committed and added to the D7 branch as well

rfay’s picture

I support this approach.

rfay’s picture

Straight reroll of #4 so it applies.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, reroute_email.turn_off_prepends_1221524_10.patch, failed testing.

rfay’s picture

Status: Needs work » Fixed
StatusFileSize
new5.36 KB

Committed to 6.x-1.x: 08807b9

I have to confess to making some verbiage changes, and I put the master checkbox at the top of the form.

rfay’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Fixed » Needs review
StatusFileSize
new12.18 KB

Here it is for D7, with the tests fixed up (and an added test for the new headers and lack of body injection).

rfay’s picture

Status: Needs review » Fixed

Committed to 7.x-1.x: 35efbcb

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.