Reading POP3 email with BeginReceive goes wrong with special characters

174 views Asked by At

I'm using the BeginReceive from Socket to receiving data from a e-mail.

I create a StringBuilder to put in the last position of the BeginReceive method, in object state

It works but StringBuilder was with strange characters. Instead of a basic portuguese name, who is in email (João Gelásio), it appears Jo=E3o Gel=E1sio

I can't understand if the problem is with StringBuilder configuration or I need to do some trick when reading the email with BeginReceive.

Can anyone help me?

Thanks in advance

1

There are 1 answers

6
Jon Skeet On

It works but StringBuilder was with strange characters. Instead of a basic portuguese name, who is in email (João Gelásio), it appears Jo=E3o Gel=E1sio

That looks like it's just a matter of the text being in quoted printable encoding. There should be headers specifying this.

Note that it has nothing to do with whether you're using async or synchronous APIs.

Ideally, use a dedicated mail API to handle POP3 instead of writing your own low-level handlers. It should cover all of this for you.