Project

General

Profile

Actions

Bug #11852

closed

Wt::Mail::Message generates wrong DATE header when in localized app

Added by Stefan Bn over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
07/31/2023
Due date:
% Done:

100%

Estimated time:

Description

When a WApplication runs in a localized environment other than "en|English" then Wt's E-Mail system might produce non RFC 5322 compliant DATE headers.

This is because the translated non-english strings are being used for the DATE string in the E-Mail header, while RFC 5322/RFC 2822 expects only english day names.

This happens in src/Wt/Mail/Message.C :

void Message::write(std::ostream& out) const
{
...
if (!date_.isNull())
out << "Date: " << date_.toString("ddd, dd MMM yyyy HH:mm:ss Z") << "\r\n";
...
}

If WApplication runs in a locale other then English, then .tostring() will use the non-english localized strings (Wt.WDate.Mon to Wt.WDate.Sun) for the DATE header.

Several E-Mail providers will reject these E-Mails with reason:

INVALID_DATE Invalid Date: header (not RFC 2822)

It took me days and hours to find out why E-Mails from my application are constantly being rejected and what's wrong with the date headers :-/ For the meantime, I change WApplication::locale to 'en' immediately before Wt::Mail::Client::send and change it back to the users selected locale afterwards.

Thus:
This refers to Wt 4.10.0, independend of the current locale, Wt::Mail::Message always should produce english day names in the DATE header.

Actions #1

Updated by Matthias Van Ceulebroeck over 1 year ago

  • Status changed from New to InProgress
  • Assignee set to Matthias Van Ceulebroeck
  • Target version set to 4.10.1
Actions #2

Updated by Matthias Van Ceulebroeck over 1 year ago

  • Status changed from InProgress to Review
  • Assignee deleted (Matthias Van Ceulebroeck)
Actions #3

Updated by Yoika Ghysens over 1 year ago

  • Assignee set to Yoika Ghysens
Actions #4

Updated by Matthias Van Ceulebroeck over 1 year ago

  • Status changed from Review to Implemented @Emweb
  • Assignee changed from Yoika Ghysens to Matthias Van Ceulebroeck
  • % Done changed from 0 to 100
Actions #5

Updated by Matthias Van Ceulebroeck over 1 year ago

  • Status changed from Implemented @Emweb to Closed
Actions

Also available in: Atom PDF