WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#3658 closed defect (bug) (duplicate)

Mail server rejects new user emails with UTF8 characters in Subject when using pl_PL translation

Reported by: warf Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.1
Component: Charset Keywords:
Focuses: Cc:

Description

When I try to register a new user, using localized content (pl_PL) mail server (postfix) refuses this mail with error message:

554 5.6.0 Message with invalid header rejected, id=08055-01-11 -
   Non-encoded 8-bit data (char C5 hex) in message header 'Subject': 
   Subject: ...t w Sopocie] Twoja nazwa u\\305\\274ytkownika i has\\305o\\n)

so I wrote a quick dirty patch (in attachment)

Attachments (1)

mail.diff (606 bytes) - added by warf 7 years ago.
Quick patch which allows to send mail with UTF characters in Subject:

Download all attachments as: .zip

Change History (20)

warf7 years ago

Quick patch which allows to send mail with UTF characters in Subject:

comment:1 foolswisdom7 years ago

wark please include the version of WordPress you are running and the version the patch is for

comment:2 warf7 years ago

Wordpress - 2.2-bleeding (svn version)

This patch is only a proposal :-)

comment:3 foolswisdom7 years ago

  • Milestone changed from 2.1.1 to 2.2
  • Version set to 2.1

comment:4 foolswisdom7 years ago

  • Milestone changed from 2.2 to 2.3

comment:5 morty7 years ago

  • Keywords wp_mail mail header umlauts added

This is a _very_ bad solution. In my plugin I solved this via checking the Subject:

mb_check_encoding($subject, "ASCII")

in case this fails I use the encode-function from the first post at http://de2.php.net/manual/de/function.mail.php

If someone thinks this makes sense, I can write a patch. Just leave me a note.

comment:6 follow-up: morty7 years ago

  • Priority changed from low to normal

And by the way I would upgrade this to normal priority as Wordpress is used in quite a few non-ASCII-languages and not encoding breaks the rfc.
Further information on the subject can be found here: http://www.faqs.org/rfcs/rfc2047.html

comment:7 Nazgul7 years ago

  • Milestone changed from 2.3 to 2.4

comment:8 Denis-de-Bernardy5 years ago

  • Keywords needs-patch added; wp_mail mail header umlauts removed

still current?

comment:9 warf5 years ago

Yes ... (2.8-bleeding-edge) Revision: 11119

2009 Apr 29 13:44:35 mail postfix/lmtp[16319]: 27B883F2129: to=<wa...@wp.pl>, relay=127.0.0.1[127.0.0.1], delay=3, status=sent (250 2.5.0 Ok wa...@wp.pl, DSN sent (554 5.6.0 Message with invalid header rejected, id=15537-01-95 - Non-encoded 8-bit data (char C5 hex) in message header 'Subject': Subject: ...nt_w_Sopocie]_Twoja_nazwa_u\\305\\274ytkownika_i_ha...))

comment:10 Denis-de-Bernardy5 years ago

it's really sad to see tickets remaining open for two years...

comment:11 hakre5 years ago

  • Component changed from Administration to Charset
  • Keywords encoding added

This is because there is no documentation how data is encoded that is used in string variables used wihtin the data flow in wordpress.

I've changed the component to charset sothat it get's on my list.

comment:12 hakre5 years ago

Related: #10862

comment:13 dwright5 years ago

  • Cc david_v_wright@… added

I tried to recreate this and cant.

steps I took:

  • wp-config.php - added: define ('WPLANG', 'pl_PL');


(pl_PL.mo) to wp-content/languages

  • added new user via backend admin area


  • email successfully received by user (no Postfix error)
    Subject: [dev_test] Twoja nazwa użytkownika i hasło
    Body:
    [dev_test] Twoja nazwa użytkownika i hasło
    
    Nazwa użytkownika: dev_test
    Hasło: dev_test
    
    wordpress/wp-login.php
    

wordpress 2.9 revision 12156

postfix version 2.5.5-1.1

Did I miss something?

comment:14 dwright5 years ago

my db settings:
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', 'utf8_general_ci');

comment:15 azaozz5 years ago

  • Milestone changed from 2.9 to Future Release

If this is still happening it would need a better patch.

comment:16 westi5 years ago

  • Keywords needs-testing added; encoding removed
  • Summary changed from Sending mail with UTF characters in Subject to Mail server rejects new user emails with UTF8 characters in Subject when using pl_PL translation

Updated summary to better summarise the issue.

Marked as needs-testing - maybe this issue has been fixed.

Otherwise will need some in depth testing.

comment:17 in reply to: ↑ 6 hakre5 years ago

Replying to morty:

And by the way I would upgrade this to normal priority as Wordpress is used in quite a few non-ASCII-languages and not encoding breaks the rfc.
Further information on the subject can be found here: http://www.faqs.org/rfcs/rfc2047.html

Morty is right, email headers (as those in HTTP) need to be ASCII regardless of the encoding in the mail-body.

comment:18 hakre5 years ago

'=?UTF-8?B?'.base64_encode($subject).'?=' Comment on PHP.net, see also rfc2047: 2. Syntax of encoded-words.

comment:19 hakre5 years ago

  • Keywords needs-patch needs-testing removed
  • Milestone Future Release deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Reviewed again, PHPMailer should take care of that. It supports B and Q encoding for the subject (and other headers/texts). Was introduced in [4946] which was after this ticket was opened. As describben in #3862, one hope was to solve encoding problems as in #209 which is quite the same like this ticket. Was then Fixed in 2.2.

I will close this ticket now as duplicate of #209.

Note: See TracTickets for help on using tickets.