There is a site on Drupal 7 + CommerceKickstart. Installed modules Mail System, Mime Mail. The problem is that when a letter comes to users from the site for password recovery, the “From” field is displayed in base64-encoding, such as =? UTF-8? B? 0JjQvdGC0LXRgNC90LXRgi3QvNCw0LPQsNC30LjQvSDQvNC + 0LTQvdC + 0Lkg0 =

In which direction to dig? Played with the settings in Drupal - does not help. Just the scripts from the server send completely normal letters, without this perversion.

Ps. The PHP mail () function is used, the server sends via Exim4.

======

Original letter

Received: from mxfront6o.mail.yandex.net ([127.0.0.1]) by mxfront6o.mail.yandex.net with LMTP id 7G2CMsFH for <real-ap@yandex.ru>; Thu, 4 Aug 2016 18:15:10 +0300 Received: from enneli.ru (enneli.ru [93.170.76.52]) by mxfront6o.mail.yandex.net (nwsmtp/Yandex) with ESMTPS id 7S8go1ZhpC-F9KeVWJf; Thu, 04 Aug 2016 18:15:09 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) Return-Path: zakaz@enneli.ru X-Yandex-Front: mxfront6o.mail.yandex.net X-Yandex-TimeMark: 1470323709 Authentication-Results: mxfront6o.mail.yandex.net; spf=pass (mxfront6o.mail.yandex.net: domain of enneli.ru designates 93.170.76.52 as permitted sender) smtp.mail=zakaz@enneli.ru X-Yandex-Spam: 1 Received: from evlanova by enneli.ru with local (Exim 4.84_2) (envelope-from <zakaz@enneli.ru>) id 1bVKLa-0004mu-FO for real-ap@yandex.ru; Thu, 04 Aug 2016 18:14:10 +0300 To: real-ap@yandex.ru Subject: =?UTF-8?B?0KHQvNC10L3QsCDQu9C+0LPQuNC90LAg0LjQu9C4INC/0LDRgNC+0LvRjyDQtA==?= =?UTF-8?B?0LvRjyByZWFsLWFwXzI3MzgyINC90LAg0YHQsNC50YLQtSDQmNC90YLQtdGA0L0=?= =?UTF-8?B?0LXRgi3QvNCw0LPQsNC30LjQvSDQvNC+0LTQvdC+0Lkg0LbQtdC90YHQutC+0Lk=?= =?UTF-8?B?INC+0LTQtdC20LTRiyDQuCDQsNC60YHQtdGB0YHRg9Cw0YDQvtCy?= X-PHP-Originating-Script: 500:mimemail.module MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="364ac6c09d5b07247906b012e3c948d0b9dfaf631" Content-Transfer-Encoding: 8Bit X-Mailer: Drupal Sender: =?UTF-8?B?Ij0/VVRGLTg/Qj8wSmpRdmRHQzBMWFJnTkM5MExYUmdpM1F2TkN3MExQUXNOQzM=?= =?UTF-8?B?MExqUXZTRFF2TkMrMExUUXZkQyswTGtnMExZPT89CiA9P1VURi04P0I/MExYUXY=?= =?UTF-8?B?ZEdCMExyUXZ0QzVJTkMrMExUUXRkQzIwTFRSaXlEUXVDRFFzTkM2MFlIUXRkR0I=?= =?UTF-8?B?MFlIUmc5Q3cwWUE9Pz0KID0/VVRGLTg/Qj8wTDdRc2c9PT89IiA8emFrYXpAZW4=?= =?UTF-8?B?bmVsaS5ydT4=?= From: =?UTF-8?B?Ij0/VVRGLTg/Qj8wSmpRdmRHQzBMWFJnTkM5MExYUmdpM1F2TkN3MExQUXNOQzM=?= =?UTF-8?B?MExqUXZTRFF2TkMrMExUUXZkQyswTGtnMExZPT89CiA9P1VURi04P0I/MExYUXY=?= =?UTF-8?B?ZEdCMExyUXZ0QzVJTkMrMExUUXRkQzIwTFRSaXlEUXVDRFFzTkM2MFlIUXRkR0I=?= =?UTF-8?B?MFlIUmc5Q3cwWUE9Pz0KID0/VVRGLTg/Qj8wTDdRc2c9PT89IiA8emFrYXpAZW4=?= =?UTF-8?B?bmVsaS5ydT4=?= Message-Id: <E1bVKLa-0004mu-FO@enneli.ru> Date: Thu, 04 Aug 2016 18:14:10 +0300 X-Yandex-Forward: 89db0c9208a4afaf33c7cac79265cf54 This is a multi-part message in MIME format. --364ac6c09d5b07247906b012e3c948d0b9dfaf631 Content-Type:multipart/alternative; boundary="c26c4788f8ffea45fdcb1e3f33d6369cf0bd0fd00" Content-Transfer-Encoding:8bit --c26c4788f8ffea45fdcb1e3f33d6369cf0bd0fd00 Content-Type:text/plain; charset=utf-8 Content-Disposition:inline Content-Transfer-Encoding:8bit real-ap_27382, Запрос на сброс пароля для вашего аккаунта был сделан на сайте Интернет-магазин модной женской одежды и аксессуаров. Вы можете сейчас войти на сайт, кликнув на ссылку или скопировав и вставив её в браузер: http://enneli.ru/user/reset/27382/1470323650/818lP8QbceYtD29gtXYSHhTjbau... [1] Это одноразовая ссылка для входа и она перебросит Вас на страницу, где Вы сможете изменить пароль. Ссылка истекает через 1 сутки и ничего не случится, если она не будет использована. -- Команда сайта Интернет-магазин модной женской одежды и аксессуаров [1] http://enneli.ru/user/reset/27382/1470323650/818lP8QbceYtD29gtXYSHhTjbauBihca9yMth04hQg4 --c26c4788f8ffea45fdcb1e3f33d6369cf0bd0fd00 Content-Type:text/html; charset=utf-8 Content-Disposition:inline Content-Transfer-Encoding:8Bit <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head> <body id="mimemail-body"> <div id="center"> <div id="main"> <p>real-ap_27382, </p> <p>Запрос на сброс пароля для вашего аккаунта был сделан на сайте Интернет-магазин модной женской одежды и аксессуаров. </p> <p>Вы можете сейчас войти на сайт, кликнув на ссылку или скопировав и вставив её в браузер: </p> <p><a href="http://enneli.ru/user/reset/27382/1470323650/818lP8QbceYtD29gtXYSHhTjbauBihca9yMth04hQg4">http://enneli.ru/user/reset/27382/1470323650/818lP8QbceYtD29gtXYSHhTjbau...</a> </p> <p>Это одноразовая ссылка для входа и она перебросит Вас на страницу, где Вы сможете изменить пароль. Ссылка истекает через 1 сутки и ничего не случится, если она не будет использована. </p> <p>-- Команда сайта Интернет-магазин модной женской одежды и аксессуаров</p> </div> </div> </body> </html> --c26c4788f8ffea45fdcb1e3f33d6369cf0bd0fd00-- --364ac6c09d5b07247906b012e3c948d0b9dfaf631-- 
  • Start by viewing in another client. perhaps it makes sense to attach the source text of the letter. - aleksandr barakin
  • It does not depend on where you look - in the mail / yandex browser interface or in Thunderbird. And where to get the source text of the Drupal letter that is automatically generated? - NDanilov2015 4:34 pm
  • in the client. For example, in the Yandex web interface, this is called “letter properties”. - aleksandr barakin
  • Attached in the original message. (Only HTML tags are not displayed even with "pre") - NDanilov2015

2 answers 2

at a minimum, both the sender header and the from header are coded twice .

I have at hand a simple perl-e script that decodes strings encoded according to rfc2045 :

 #!/usr/bin/perl -CAO use Encode qw(decode); $na=$#ARGV+1; if($na==1) {print decode("MIME-Header","$ARGV[0]"),"\n"} else {while (<>) { print decode("MIME-Header",$_); }} 

it can be passed encoded either to stdin , or as the first argument.


decoding, for example, the sender header:

 Sender: =?UTF-8?B?Ij0/VVRGLTg/Qj8wSmpRdmRHQzBMWFJnTkM5MExYUmdpM1F2TkN3MExQUXNOQzM=?= =?UTF-8?B?MExqUXZTRFF2TkMrMExUUXZkQyswTGtnMExZPT89CiA9P1VURi04P0I/MExYUXY=?= =?UTF-8?B?ZEdCMExyUXZ0QzVJTkMrMExUUXRkQzIwTFRSaXlEUXVDRFFzTkM2MFlIUXRkR0I=?= =?UTF-8?B?MFlIUmc5Q3cwWUE9Pz0KID0/VVRGLTg/Qj8wTDdRc2c9PT89IiA8emFrYXpAZW4=?= =?UTF-8?B?bmVsaS5ydT4=?= 

we receive instead of the text:

 Sender: "=?UTF-8?B?0JjQvdGC0LXRgNC90LXRgi3QvNCw0LPQsNC3 0LjQvSDQvNC+0LTQvdC+0Lkg0LY=?= =?UTF-8?B?0LXQv dGB0LrQvtC5INC+0LTQtdC20LTRiyDQuCDQsNC60YHQtdGB 0YHRg9Cw0YA=?= =?UTF-8?B?0L7Qsg==?=" <zakaz@en neli.ru> 

similar picture with the title from .


those. the solution in your case is to find that place in the code that forms the letter in which the second (or the first, depending on where to start the counting) encoding is performed. I suspect this happens somewhere during the preparation of the letter before calling the mail() function.

  • Hooray, I solved the problem! See above my answer) Thank you so much! - NDanilov2015

Yes, really coded! I solved the problem. The casket just opened, the module just needs to update Mime Mail. This is a famous glitch in one of the versions: No. 1908318 by jvieille, zionduc, bisonbleu | anrkaid: Sender is double encoded https://www.drupal.org/node/1908318