From 3724a0f9f259b8dfbe0ca9c4ca0ce3d2d2bd31f8 Mon Sep 17 00:00:00 2001 From: Shawn Kwang Date: Fri, 8 Mar 2019 12:25:30 -0600 Subject: [PATCH] Drupal: Add boinccore_mail_alter to change encoding. Changes header and body encoding to use 'quoted-printable'. Part of https://dev.gridrepublic.org/browse/DBOINCP-479 --- .../boinc/modules/boinccore/boinccore.module | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drupal/sites/default/boinc/modules/boinccore/boinccore.module b/drupal/sites/default/boinc/modules/boinccore/boinccore.module index ea485da4cd..a84b54288e 100644 --- a/drupal/sites/default/boinc/modules/boinccore/boinccore.module +++ b/drupal/sites/default/boinc/modules/boinccore/boinccore.module @@ -787,6 +787,21 @@ function boinccore_link($type, $object, $teaser = FALSE) { return $links; } +/** + * Implementation of hook_mail_alter() + */ +function boinccore_mail_alter(&$message) { + /* This code alters the headers for all emails sent by the Drupal Web site to use + 'Quote-Printable' as the encoding, both altering the header and modifies the body to the + new encoding. + */ + $message['headers']['Content-Transfer-Encoding'] = 'Quoted-Printable'; + if (is_array($message['body'])) { + $message['body'] = array_map( "quoted_printable_encode", $message['body'] ); + } else { + $message['body'] = quoted_printable_encode($message['body']); + } +} /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * Page callbacks from hook_menu()