Invalid date:invalid time zone:Sun, 02 Aug 2009 22:06:00 +05-30

Jan 9, 2012 at 10:27 AM

Hi,

 

Im getting below error while reading email from gmail smtp.

Message.Date Property throwing:  Invalid date:invalid time zone:Sun, 02 Aug 2009 22:06:00 +05-30

any help in this regard is highly appreciated.

 

regards,

Kishore. S

 

Coordinator
Jan 11, 2012 at 1:51 PM

It looks wrong format mail.
So, it is a spec not to parse correctly.

I'll plan to make some way to get efficient data.
Please wait.

Coordinator
Jan 12, 2012 at 3:38 AM

C#Mail was moved to HigLabo project.
http://higlabo.codeplex.com/

You can catch InvalidPop3MessageException.And you can get mail text data from MailText property of InvalidPop3MessageException.
This property exist latest version of HigLabo project.
By using this property,you can parse wrong mail with your own modification.

-----sample code--------------------------------------------------------------------
Pop3Message mg = null;
var cl = new Pop3Client();
//...Set property
try
{
     mg = cl.GetMessage(1);
}
catch (InvalidPop3MessageExeption ex)
{
    String s = ex.MailText;
    String modifiedText = s.Replace("+05-30", "+05:30");
    mg = new Pop3Message(modifiedText);
}
-------------------------------------------------------------------------------------------

Is it solve your problem?