共用方式為


2.2.1.17 SendMail

The SendMail command is used by clients to send MIME-formatted email messages to the server. The body of the request depends on the protocol version that is being used. See the details about protocol versions at the end of this section.

The ComposeMail namespace is the primary namespace for this section. Elements referenced in this section that are not defined in the ComposeMail namespace use the namespace prefixes defined in section 2.2.4.

The following table lists the elements that are used in SendMail command requests and responses.

Element name

Scope

Reference

SendMail

Request and Response

section 2.2.3.162

ClientId

Request

section 2.2.3.28.1

AccountId

Request

section 2.2.3.3.1

SaveInSentItems

Request

section 2.2.3.157

Mime

Request

section 2.2.3.109

Status

Response

section 2.2.3.177.14

The XML schema for the SendMail command request is described in section 6.36. The XML schema for the SendMail command response is described in section 6.37. If the message was sent successfully, the server returns an empty response.

 HTTP/1.1 200 OK
 Date: Thu, 03 Sep 2009 21:05:44 GMT
 Content-Length: 0

Clients SHOULD NOT save messages directly to the local Sent Items folder; instead, clients SHOULD use the SaveInSentItems element (section 2.2.3.157) to automatically save the messages on the server. It is not possible to reconcile the local Sent Items folder with the server's Sent Items folder by using the Sync command (section 2.2.1.21). Items in the server's Sent Items folder can be added to the client by using the Sync command, but it is not possible to add items that are in the local Sent Items folder to the server.

Note that the From: MIME header in the outgoing message is set on the server to the primary email address of the authenticated user.

Protocol Versions

The following table specifies the protocol versions that support this command. The client indicates the protocol version being used by setting either the MS-ASProtocolVersion header, as specified in [MS-ASHTTP] section 2.2.1.1.2.6, or the Protocol version field, as specified in [MS-ASHTTP] section 2.2.1.1.1.1, in the request.

Protocol version

Command support

2.5

Yes

12.0

Yes

12.1

Yes

14.0

Yes

14.1

Yes

16.0

Yes

16.1

Yes

The body of the request differs as follows, depending on the protocol version being used by the client.

  • For protocol versions 2.5, 12.0, and 12.1, the body of the SendMail request is the MIME representation of the message to be sent. In this case, the client sets the Content-Type header to "message/rfc822".

  • For protocol versions 14.0, 14.1, 16.0, and 16.1, the body of the SendMail request is WBXML data generated by using the XML elements specified in the table of elements shown earlier in this section.