Activesync:使用MIME类型的Sendmail命令

时间:2021-08-02 12:00:10
     <?xml version="1.0" encoding="utf-8"?>
     <SendMail xmlns="ComposeMail:" xmlns:airsync="AirSync">
     <ClientId>34234243</ClientId>
     <SaveInSentItems />
     <Mime>
        From:xxx@.com 
        To:yyy@.com 
        Subject:342234 MIME-Version: 1.0 
        Content-Type: text/plain; 
        charset="iso-8859-1" 
        Content-Transfer-Encoding: base64 
         X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 234234
        This is body  
     </Mime>
     </SendMail>

I am working with SendEmail command. I am looking for way to send Mime content to server. I have tried:

我正在处理SendEmail命令。我正在寻找将Mime内容发送到服务器的方法。我有尝试:

  • Convert the above xml in wbxml and setBOdy HTTP request but server return 103 error code.

    在wbxml和setBOdy HTTP请求中转换上述xml,但是服务器返回103错误代码。

  • Convert the Content betweent to Base64, and append to old string like this:

    将内容转换为Base64,并将其附加到旧字符串如下:

    <?xml version="1.0" encoding="utf-8"?>
    <SendMail xmlns="ComposeMail:" xmlns:airsync="AirSync"><ClientId>34234243</ClientId>
    <SaveInSentItems/>
    <Mime>
     text encode base 64
    </Mime>
    </SendMail>
    

And convert to wbxml, send to server and receive error code 119 mean :MessageHasNoRecipient The message being sent contains no recipient. Anybody help? thanks in advance

然后转换到wbxml,发送到服务器并接收错误代码119意味着:messagehas notecipient正在发送的消息不包含收件人。有人帮助吗?谢谢提前

2 个解决方案

#1


1  

I am sure you have a blank character before the "To" keyword in your code. Let's remove it. Your data before you encode it to base64 encoding must to look like this:

我确信您的代码中在“To”关键字之前有一个空白字符。让我们删除它。在将数据编码为base64编码之前,必须如下所示:

   From: xxx@xxx.com
   To: xxx@xxx.com 
   Subject: Mail Subject 
   MIME-Version: 1.0 
   Content-Type: text/plain; charset=utf-8 
   Content-Transfer-Encoding: base64 

   Test body

Best regards,

最好的问候,

#2


0  

From MS documentation Mime element must be opaque BLOB https://msdn.microsoft.com/en-us/library/gg663453(v=exchg.80).aspx. So you must write Mime data as CDATA.

从MS文档中,Mime元素必须是不透明的BLOB https://msdn.microsoft.com/en-us/library/gg663453(v=exchg.80).aspx。因此必须将Mime数据编写为CDATA。

<Mime>
<![CDATA[From: xxx@xxx.com
To: xxx@xxx.com 
Subject: Mail Subject 
MIME-Version: 1.0 
Content-Type: text/plain; charset=utf-8 

Test body]]>
</Mime>

#1


1  

I am sure you have a blank character before the "To" keyword in your code. Let's remove it. Your data before you encode it to base64 encoding must to look like this:

我确信您的代码中在“To”关键字之前有一个空白字符。让我们删除它。在将数据编码为base64编码之前,必须如下所示:

   From: xxx@xxx.com
   To: xxx@xxx.com 
   Subject: Mail Subject 
   MIME-Version: 1.0 
   Content-Type: text/plain; charset=utf-8 
   Content-Transfer-Encoding: base64 

   Test body

Best regards,

最好的问候,

#2


0  

From MS documentation Mime element must be opaque BLOB https://msdn.microsoft.com/en-us/library/gg663453(v=exchg.80).aspx. So you must write Mime data as CDATA.

从MS文档中,Mime元素必须是不透明的BLOB https://msdn.microsoft.com/en-us/library/gg663453(v=exchg.80).aspx。因此必须将Mime数据编写为CDATA。

<Mime>
<![CDATA[From: xxx@xxx.com
To: xxx@xxx.com 
Subject: Mail Subject 
MIME-Version: 1.0 
Content-Type: text/plain; charset=utf-8 

Test body]]>
</Mime>