Wt::Mail::Message generates wrong DATE header when in localized app
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
void Message::write(std::ostream& out) const
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.
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.