我正在使用 EWS 将邮件发送到Exchange Server。我能够发送没有附件的邮件。当我添加任何附件时,它会失败并发出此错误:
04-09 13:05:56.157: E/EWSJava!!!(26633): >>>> SimpleServiceRequestBase.internalExecute() Exception An element node 'm:CreateAttachmentResponse' of the type START_ELEMENT was expected, but node '{http://schemas.xmlsoap.org/soap/envelope/}Fault' of type START_ELEMENT was found.
我可以看到邮件已保存在草稿中(草稿中没有附件)。
我的代码是:
EmailMessage message = new EmailMessage(acct.ewsService);
message.getToRecipients().add(sRecipients);
message.setSubject(sSubject);
message.setBody(MessageBody.getMessageBodyFromText(sBody));
if (fAttachments != null) {
for (File f : fAttachments) {
Log.i("MailSender", "SendSMTPMail() attaching: " + f.getPath());
message.getAttachments().addFileAttachment(f.getPath());
}
}
Log.i("MailSender", "SendMail: pre-message.send()");
message.send();
Log.i("MailSender", "SendMail: post-message.send()");
编辑:
当我尝试发送小尺寸文件时,相同的代码正在运行。但它没有像图像这样更大尺寸的附件。