You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
local_date_time message::parse_date(const string& date_str) const function returns not_a_date_time whenever the timezone offset is not included in the email time stamp. This is a usual occurrence.
My suggested solution:
local_date_time message::parse_date(const string& date_str) const
{
try
{
string tmp_date_str(date_str);
if (date_str.find('+') == string::npos)
tmp_date_str+=" +0000";
// date format to be parsed is like "Thu, 17 Jul 2014 10:31:49 +0200 (CET)"
regex r(R"(([A-Za-z]{3}[\ \t]*,)[\ \t]+(\d{1,2}[\ \t]+[A-Za-z]{3}[\ \t]+\d{4})[\ \t]+(\d{2}:\d{2}:\d{2}[\ \t]+(\+|\-)\d{4}).*)");
smatch m;
if (regex_match(tmp_date_str, m, r))
{
...
The text was updated successfully, but these errors were encountered:
According to the RFC 5322 section 3.3, the timezone is mandatory. In case it is neglected, it should be in the non-strict mode. Can you please tell me from which email server or client you are experiencing this case? I do not recall I had it.
Problem
Email date/time parsing often fails
local_date_time message::parse_date(const string& date_str) const
function returnsnot_a_date_time
whenever the timezone offset is not included in the email time stamp. This is a usual occurrence.My suggested solution:
The text was updated successfully, but these errors were encountered: