0 votes
by (180 points)
edited

Hi,

The following error was logged in our system. It seems like the error happened when setting the subject property. I'm trying to find out what special characters would cause this error.

Source: Rebex.Mail Message: Invalid character at position 162. Parameter name: value

Stack Trace: at cSVAqj.CkMqVUZ.BIzNVcZ(String , String , Boolean ) at Rebex.Mime.Headers.Unstructured..ctor(String , Boolean ) at Rebex.Mail.MailMessage.set_Subject(String value)

I have tried to set these special characters in the subject and it seems to work:

@, #, $, %, ^, &, *, (, ), +, =, {, }, |, ', ~, `

Your help would be appreciated.

Thank you, Rajat

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (144k points)
edited

This error is caused by special non-printable characters with ASCII code less than 32 (except the 'tab' character).

For example, the following code will throw the same exception:

C#:

var mail = new MailMessage();
mail.Subject = "Bad character: \x1";

VB.NET:

Dim mail as New MailMessage
mail.Subject = "Bad character: " & Chr(1)
...