0

I have got a console application that processes emails in a mailbox using OpenPOP, it is failing on one email with the following exception

An invalid character was found in the mail header: '\u007f

The code it is calling is the following

            MailMessage _testMail = emailFile.ToMailMessage();               
            _testMail.BodyEncoding = Encoding.UTF8;
            _testMail.Subject = _testMail.Subject + " Issue ID: " + callid;

it is failing when it calls emailFile.ToMailMessage() and help would be appreciated

ccStars
  • 817
  • 2
  • 11
  • 34

1 Answers1

1

\u007f is the DELETE character - that seems to be invalid in your context. You might have to strip unwanted characters from your input before calling .ToMailMessage.

germi
  • 4,628
  • 1
  • 21
  • 38