Decode a string which was previously encoded using base64 or quoted-printable encoding.
The number of characters of decoded text. A return value of zero indicates no text has been decoded. If the method fails, it will return -1 and the LastError property can be used to determine the cause of the failure. In most cases where the method fails, it is because an invalid character set or encoding type has been specified.
This method provides a means to decode text that was previously encoded using either base64 or quoted-printable encoding. In most cases, it is not necessary to use this method because the message parser will detect which character set and encoding was used, then automatically decode the message text if necessary.
The value of the charSet parameter does not affect the resulting output text, it is only used when decoding the input text. The previous contents of the messageText string will be replaced by the decoded text, and the output string will always be Unicode.
If the charSet parameter is specified as charsetUTF16, the encoding type must be encodingBase64. Other encoding methods are not supported for Unicode strings and will cause the method to fail. In most cases, it is preferable to always use encodingBase64 as the encoding method, with quoted-printable encoding only used for legacy support. If an unsupported encoding type is specified, this method will return -1 and the output text string will be empty. This method cannot be used to decode uuencoded text.
MailMessage Class | SocketTools Namespace | MailMessage.DecodeText Overload List