#1483990 closed Bugs (duplicate)
UTF-8 encoded sender/recipient modified by Postfix
| Reported by: | jan.halasa@… | Owned by: | olive@… |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.1-rc1 |
| Component: | Core functionality | Version: | 0.1-beta2 |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Hello,
when an identity of sender or recipient contains non-ASCII characters and is encoded to Quoted-Printable (using UTF-8),
my POP3 server (panda.bk.cz - Postfix) appends ', @panda.bk.cz'
to it. I think that the problem lies in enclosing actual email
address in encoded text boundaries (=?UTF-8?Q? ... ?=).
Below are 3 versions of email headers (sent from/to Ján Halaša, I replaced my email with '...').
Those from Kmail (my desktop email client) are correct.
RoundCube sends to SMTP:
From: =?UTF-8?Q?J=C3=A1n=20Hala=C5=A1a=20<...>?=
To: =?UTF-8?Q?J=C3=A1n=20Hala=C5=A1a=20<...>?=
What appears in email:
From: =?UTF-8?Q?J=C3=A1n=20Hala=C5=A1a=20 <...>,
?=@panda.bk.cz
To: =?UTF-8?Q?J=C3=A1n=20Hala=C5=A1a=20 <...>,
?=@panda.bk.cz
KMail sends this:
From: =?utf-8?q?J=C3=A1n_Hala=C5=A1a?= <...>
To: =?utf-8?q?J=C3=A1n_Hala=C5=A1a?= <...>
Change History (4)
comment:1 Changed 7 years ago by olive@…
comment:2 Changed 7 years ago by olive@…
here is the patch to solve the problem. This is hackish and requires php5-imap, but it works like a charm.
in program/step/mail/sendmail.inc, line 98, put :
// replace new lines and strip ending ', '
$mailto = preg_replace($mailto_regexp, $mailto_replace, get_input_value('_to', RCUBE_INPUT_POST, TRUE, $message_charset));
+// properly re-encode $mailto if needed
+$mailaddr_regex = '/([^<]*)[<]([^>]*)[>]/';
+$recipients = explode(",", $mailto);
+foreach ($recipients as $recipient) {
+ $recipient = trim($recipient);
+ $matches = "";
+ if ( preg_match($mailaddr_regex, $recipient, $matches) ) {
+ $encoded_recipients[] = '=?' . $message_charset . '?Q?' . +imap_8bit($matches[1]) . '?= <' . $matches[2] . '>';
+ }
+ else {
+ $encoded_recipients[] = $recipient;
+ }
+}
+$mailto = implode(',', $encoded_recipients);
and don't forget the patch for the $from too (found on roundcube forums) (line 111, sendmail.inc):
- 'From' => $identity_arr['string'], + 'From' => '=?' . $message_charset . '?Q?' . imap_8bit($identity_arr['name']) . '?= <' . $identity_arr['email'] . '>',
comment:3 Changed 7 years ago by olive@…
- Milestone set to 0.1-rc1
- Owner set to olive@…
- Status changed from new to assigned
now that there is a patch, could it be targeted at next version ? It really helps with foreing languages... (i'm french and use accents everywhere).
comment:4 Changed 7 years ago by honza
- Resolution set to duplicate
- Status changed from assigned to closed
Duplicate #1483976. Fixed in [bb5ddfa0].

I confirm this bug. My username in roundcube is "Olivier Cortès".
when I send a mail from RC to me (and let default send encoding to UTF-8), it arrives like this in my Mailbox (other uninteresting parts deleted) :
From: =?UTF-8?Q?Olivier=20Cort=C3=A8s=20 <olivier.cortes@…>,
To: =?UTF-8?Q?Olivier=20Cort=C3=A8s=20 <olive@…>,
servecole.abuledu is the FQDN of the host running RC and postfix which sends the mail.
When I select iso-8859-1 as the transfer encoding in RC and send the mail to "olive@…" (just the e-mail adress, without my name), the headers of the mail in my recipient mailbox look like this :
From: =?ISO-8859-1?Q?Olivier=20Cort=C3=A8s=20 <olivier.cortes@…>, ?=@servecole.abuledu
To: olive@…
If I put an accentuated letter in the To: field ( = "Olivier Cortès <olive@…>") and select iso-8859-1 the message get lost, I never receive it ! See the log of the local mail server :
Sep 29 16:21:31 servecole postfix/qmgr[5256]: 87366DD384: from=<olivier.cortes@…>, size=639, nrcpt=2 (queue active)
Sep 29 16:21:31 servecole postfix/local[25132]: 87366DD384: to=<Cort@…>, orig_to=<Cort>, relay=local, delay=0, status=bounced (unknown user: "cort")
Sep 29 16:21:32 servecole postfix/local[25133]: 87366DD384: to=<Olivier@…>, orig_to=<Olivier>, relay=local, delay=1, status=bounced (unknown user: "olivier")
The To: has been split on the "è" of "Olivier Cortès <olive@…>" !!