首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >发送邮件请求在mime数据上失败

发送邮件请求在mime数据上失败
EN

Stack Overflow用户
提问于 2013-12-21 03:34:13
回答 1查看 232关注 0票数 0

我在一个基于C#的ActiveSync客户端上工作,在尝试将Sendmail命令发送到服务器时遇到了问题。我使用以下格式的mime数据进行测试:

代码语言:javascript
复制
    var testMsg = @"From: a@b.com
To: a@b.com
Cc:
Bcc:
Subject: From NSync
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
VGhpcyBpcyB0aGUgYm9keSB0ZXh0Lg==";

    var data = UTF8Encoding.UTF8.GetBytes(testMsg);

当服务器获取数据时,我在Exchange客户端日志中收到以下异常:

代码语言:javascript
复制
Command_WorkerThread_Exception : 
--- Exception start ---
Exception type: Microsoft.Exchange.AirSync.Wbxml.WbxmlException
Exception message: Invalid WBXML code/codepage from client
Exception level: 0
Exception stack trace:    at Microsoft.Exchange.AirSync.Wbxml.WbxmlReader.ReadXmlDocument()
   at Microsoft.Exchange.AirSync.AirSyncRequest.get_XmlDocument()
   at Microsoft.Exchange.AirSync.Command.get_XmlRequest()
   at Microsoft.Exchange.AirSync.Command.WorkerThread()
Inner exception follows...
Exception type: System.IndexOutOfRangeException
Exception message: Index was outside the bounds of the array.
Exception level: 1
Exception stack trace:    at Microsoft.Exchange.AirSync.Wbxml.WbxmlSchema30.GetName(Int32 tag)
   at Microsoft.Exchange.AirSync.Wbxml.WbxmlReader.FillXmlElement(XmlElement elem, Int32 depth, Boolean elemIsSecureData, Boolean elemIsBlobData)
   at Microsoft.Exchange.AirSync.Wbxml.WbxmlReader.FillXmlElement(XmlElement elem, Int32 depth, Boolean elemIsSecureData, Boolean elemIsBlobData)
   at Microsoft.Exchange.AirSync.Wbxml.WbxmlReader.ReadXmlDocument()
--- Exception end ---
EN

回答 1

Stack Overflow用户

发布于 2013-12-21 05:21:46

我发现我的问题与发送的消息无关。这个问题与我们序列化到WBXML的方式有关。

在写入不透明数据时,对于MIME内容,首先需要放入数据长度,然后放入字节数组。我写数据长度的代码关闭了,这导致了这个问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20710746

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档