开发者

Trying to send XML via EMail and the XML includes a byte[]

I want to send an email that has a machine readable part you cut and paste into an asp.net page and you get the information.

I have stored all the information in an object and then used an XMLSerizer to create some xml. It all worked fine until I added some Images as byte[] to the object.

If I dump the resulting string to disk then I can recreate the object fine but after it appears in th开发者_运维问答e email client and I try to cut and paste it it never works.

Clearly there are non standard characters coming out that email clients don't like.

Is there some encoding I could apply to my XML that would make it display correctly in an email client? Then I could cut, paste, decode and deserilize to get my object back.

Please an example of how to encode the string in c# would be great.


You need to encode your byte array to base64 before adding into the xml

string x = Convert.ToBase64(bytearray);

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜