Please help me. I get this error during retrieving email.

Message: Quoted-printable decoding error in header 'Subject'.

Exception: Core.EmailAccountManager.ImportEmails at cSVAqj.CkMqVUZ.ATsxQKZ(String , Int32 , Int32 ) at cSVAqj.CkMqVUZ.elhKQZ(String , Int32 , crJYrO ) at cSVAqj.CkMqVUZ.BrIywR(String ) at Rebex.Mime.Headers.Unstructured.clLXPXZ(ALmPMm ) at Rebex.Mime.MimeHeader.clLXPXZ(String , String ) at Rebex.Mime.MimeHeader.get_Value() at Rebex.Mime.MimeHeaderCollection.BGlmNGZ(String ) at Rebex.Mime.MimeMessage.get_Subject() at Rebex.Mail.MailMessage.get_Subject() at Core.EmailAccountManager.ImportEmails(Int32 emailAccountID) in D:\GO-NET Projects\Classica\CRM\Core\EmailAccountManager.cs:line 158

asked 04 Apr '10, 05:58

Yarik's gravatar image

Yarik
161
accept rate: 0%

Can you please save the email using MailMessage object's Save method and mail it to us (support@rebex.net) for analysis? Alternatively, open it using notepad or a similar text editor and post the content of Subject header here. We should be able to help then!

(05 Apr '10, 12:42) Lukas Pokorny ♦♦

The error most likely occurred because the e-mail message's subject header was not properly encoded and could not be parsed by Rebex Mail.

The following code reproduces the same error:

string source = "Subject: =?us-ascii?Q?This_is_wrong_=_?=\r\n\r\nText"; 
MailMessage mail = new MailMessage();
mail.Load(System.Text.Encoding.ASCII.GetBytes(source));
string subject = mail.Subject;

This produces an exception when accessing the MailMessage object's Subject property.

Workaround 1: Prior to loading the message, enable IgnoreUnparsableHeaders option by adding the following line:

mail.Options |= MimeOptions.IgnoreUnparsableHeaders;

If the message was not loaded from a file, stream or byte array but retrieved from an Imap or Pop3 object instead, a corresponding IgnoreUnparsableHeaders is available for Imap.Options and Pop3.Options property (enable ImapOptions.IgnoreUnparsableHeaders or Pop3Options.IgnoreUnparsableHeaders, respectively).

Workaround 2: If accessing MailMessage.Subject fails, use the content of MailMessage.Headers["subject"].Raw instead. If possible, please let us know the content of this property, it might help us to determine what exactly is going on and perhaps enhance the parser to handle some kind of broken input as well.

link

answered 06 Apr '10, 17:45

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.2k18
accept rate: 32%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×46

Asked: 04 Apr '10, 05:58

Seen: 1,331 times

Last updated: 23 Mar '11, 14:23