Site Optimized for Chrome and Firefox

API Console
To help protect AT&T subscribers against improper messaging activity,
the SMS and MMS APIs require Premium Access and special permission before they can be used. the SMS and MMS APIs require Premium Access and special permission before they can be used.
1. Introduction

The MMS API sends MMS messages to one or more supported AT&T Wireless mobile devices and receives MMS messages from mobile devices. This API enables developers to check the delivery status of the MMS messages previously accepted by the API Gateway for delivery. Developers may specify that their apps either poll for the delivery status or request that the app be notified to a registered callback listener URI for your app account. In the latter case, the delivery status notifications are pushed to the registered endpoint for your app account as soon as the message is delivered to the user's mobile device or when the message expires after the exhaustion of all the retry attempts as configured in the API Gateway.

Considerations

The RESTful MMS API provided by AT&T has the following considerations for you to keep in mind.

Data Usage Charges: The cost unit for the billing of messages using the MMS API is measured in kilobytes (kBs). Unlike other messaging APIs there is no per message cost associated with the use of this API, except in the case of premium rated MMS short code usage. The developer should not incur charges for kB usage caused by consumption of the MMS API for either the sending of messages to mobile devices or receiving mobile originated (MO) messages sent to the short code of the app call flows. When an AT&T Wireless customer uses the app to send an MMS message to a standard rated short code that is allocated to the app account, then the customer incurs usage charges per kB for sending that MMS content to the short code of the app. If a web app that utilizes a standard rated short code sends an MMS message to the customer’s MSISDN and the customer uses the app on a mobile device, then that customer is responsible for the usage charges per kB associated with the download of the content of that message to the mobile device.

MMS Message: The MMS message payload may be composed of ASCII and extended ASCII characters or the message payload may contain text represented in a two-byte data coding scheme, such as USC-2. In the case of multi-byte characters being sent or received by an app, the charset parameter of the Content-type HTTP header must accurately reflect all of the character sets used in the message.

MSISDN: The senderAddress parameter must be the mobile number for an AT&T Wireless customer. The MMS API supports sending and receiving messages to and from AT&T Wireless customers only.

Short code: When using the GSMA OneAPI endpoint, the senderAddress parameter may be assigned to one of the short codes for the app that is sending the message. When an app is allocated multiple short codes, the App to Mobile messages that are sent must contain the senderAddress parameter set to the highest numbered short code provisioned for the app.

The AT&T Wireless network retries deliveries to the AT&T Wireless customer for up to 72 hours; after which time any undeliverable messages are deleted from the AT&T Wireless network.

The delivery of MMS messages is not guaranteed, but has a very high delivery rate. Delivery of MMS messages depends on many factors, such as the status of the target mobile device. The delivery status of the message indicates the final status of the MMS message.

The delivery status of a sent message may be obtained either by polling the API Gateway using a method call with the message ID returned by the API Gateway or registering an endpoint URL where the final status will be notified by the API Gateway. For a given message only one mechanism could be used based on the preference indicated by the app in the request.

Messaging using the map:group format is not supported. However, multiple destination addresses may be included in a single Send MMS request. The maximum number of recommended and supported destination addresses in a single message is 10.

Provisioning

The RESTful MMS API provided by AT&T requires that you provision your app as follows.

You must register the MMS API for your app account on the AT&T Developer Program web site in order to utilize this API.

When you request a short code to be associated with your app, you should specify the following properties.

  • Type of short code: Default Provided or Custom
  • Reception of Mobile Originated (MO) messages: Online via callback or Offline via polling
  • Message rating: Free to user or Standard rated

You may also bring your own common short code or request specific custom short codes for your app. This process may take from 1-2 weeks to be approved and provisioned by AT&T.

2. OAuth

The APIs provided by AT&T use the OAuth 2.0 framework, and an OAuth access token must be included in each request to the API Gateway. To obtain an OAuth access token, use the App Key and App Secret from the My Apps section after registering and signing into your API Platform account.

You may authorize access for this API by using the following scope.

  • "MMS" for the Get MMS Delivery Status method, the Receive MMS callback, the Receive MMS Delivery Status callback, and the Send MMS method.

To obtain your OAuth access token run the following command from the Command Line Interface window and replace "{{APP_KEY}}", "{{APP_SECRET}}", and "{{API_SCOPES}}" with the App Key, App Secret, and the API scopes you wish to access as follows.

Get Access Token method using the cURL command:

copy
curl "https://api.att.com/oauth/token" \
    --insecure \
    --header "Accept: application/json" \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --data "grant_type=client_credentials&client_id={{APP_KEY}}&client_secret={{APP_SECRET}}&scope={{API_SCOPES}}" 

A successful response from the API Gateway contains an OAuth access token, the expiration period, and a refresh token as displayed in the following example.

Response from the API Gateway for the Get Access Token method:

{
    "access_token":"{{OAUTH_ACCESS_TOKEN}}",
    "token_type": "bearer",
    "expires_in":{{EXPIRATION_PERIOD}},
    "refresh_token":"{{REFRESH_TOKEN}}"
} 

Extract the value from "{{OAUTH_ACCESS_TOKEN}}" to use in the Authorization parameter for requests to the API Gateway. When sending a request to the API Gateway a successfully constructed Authorization parameter looks like the following.

Authorization parameter for the HTTP header:

Authorization: Bearer {{OAUTH_ACCESS_TOKEN}} 

For more information about refresh_token and other authentication options, see the OAuth 2.0 API.

3. Resources
Get MMS Delivery Status

Select provider:

Overview

The Get MMS Delivery Status method requests the status of a previously submitted Send MMS method request that was accepted by the API Gateway for delivery to the destination mobile device. The message identifier returned in the response of the corresponding Send MMS method must be provided in the Get MMS Delivery Status method request. Note: This method of polling for the delivery status message only works when the notifyDeliveryStatus parameter is either set to false or is not present in the Send MMS method request. When one of the following events occur the delivery status removed from the API Gateway and is not available for the app to query it.

  • Thirty minutes after the message has reached the final state; the final state is on of the following values.
    • DeliveredToTerminal
    • DeliveryImpossible
  • Once the API Gateway responds to the first delivery status request from the app after the message has reached the final state.
  • OAuth Scope
  • Scope: MMS

  • Model: client_credentials

  • Resource
  • copy
    GET https://api.att.com/mms/v3/messaging/outbox/{{messageId}}
Examples

Request

copy
GET /mms/v3/messaging/outbox/MMSa9b1927803784049
Authorization: Bearer 38C2399A23999
Accept: application/json

Response

copy
{
    "DeliveryInfoList": {
        "DeliveryInfo": [ {
                "Id" : "msg0",
                "Address" : "tel:3500000992",
                "DeliveryStatus" : "DeliveredToTerminal" } ] ,
        "ResourceUrl": https://api.att.com/mms/v3/messaging/outbox/MMSa9b192780378404c
    }
} 
Request Parameters
Parameter
Accept String Header
Specifies the format of the body for the response. The acceptable values for this parameter are:
  • application/json
  • application/xml
  • application/x-www-form-urlencoded
The default value is application/json.
Authorization String Header
Specifies the authorization. The acceptable format for this parameter is the word "Bearer" followed by a space ( ) and an OAuth access token. If this parameter value is missing from the header, then the API Gateway returns a message with an HTTP status code of 400 Invalid Request. If the OAuth access token is not valid, then the API Gateway returns an HTTP status code of 401 Unauthorized with a WWW-Authenticate HTTP header.
messageId String ResourceURL
Specifies the MMS message identifier that is returned as part of the MMS API response.
Response Parameters
Parameter
DeliveryInfoList DeliveryInfoList object Body
Specifies a list of one or more deliveryInfo parameters that describe the delivery status of the messages that was previously requested by the app.
deliveryInfo DeliveryInfo Object Body
Specifies the delivery information related to a particular destination. There could be more than one instance of this object present. This parameter is a child of the DeliveryInfoList parameter.
Id String Body
Specifies the ID returned by the API Gateway that represents a unique message. The unique message ID is relevant if the original message was sent to more than one destination address. Note: This parameter is only present when the AT&T URI is used by the app. This parameter is a child of the DeliveryInfo parameter.
Address String Body
Specifies the mobile number of AT&T Wireless customer's device to which the original message was sent. This parameter is also a child of the DeliveryInfo parameter.
DeliveryStatus String Body
Specifies the status of the MMS message that is delivered. The acceptable values for this parameter are:
  • DeliveredToNetwork : The message is delivered to the network, but not yet delivered to the user's mobile device.
  • DeliveredToTerminal : The message is successfully delivered to the user's mobile device.
  • DeliveryImpossible : The message is not successful delivered, such as when the message is not delivered before the message expires.
  • DeliveryUnCertain : The delivery status of the message could not be determined by the API Gateway.
This parameter is a child of the DeliveryInfo parameter.
ResourceUrl anyURI Body
Specifies the endpoint URI that serves this request. This parameter is a self-referring URL. This parameter is a child of the DeliveryInfoList parameter.
Overview

The Get MMS Delivery Status method requests the status of a previously submitted Send MMS method request that was accepted by the API Gateway for delivery to the destination mobile device. The message identifier returned in the response of the corresponding Send MMS method must be provided in the Get MMS Delivery Status method request. Note: This method of polling for the delivery status message only works when the notifyDeliveryStatus parameter is either set to false or is not present in the Send MMS method request. When one of the following events occur the delivery status removed from the API Gateway and is not available for the app to query it.

  • Thirty minutes after the message has reached the final state; the final state is on of the following values.
    • DeliveredToTerminal
    • DeliveryImpossible
  • Once the API Gateway responds to the first delivery status request from the app after the message has reached the final state.
  • OAuth Scope
  • Scope: MMS

  • Model: client_credentials

  • Resource
  • copy
    /messaging/outbound/requests/{{senderAddress}}/{{requestId}}/deliveryInfos
Examples

Request

copy
GET /2/messaging/outbound/tel%3A%2B12345678/MMSa9b1927803784049/deliveryInfos
Authorization: Bearer 38C2399A23999
Accept: application/json

Response

copy
{
    "deliveryInfoList": {
        "deliveryInfo": [
            {
                "address": "tel:+14258028620",
                "deliveryStatus": "DeliveredToTerminal"
            }
        ],
        "resourceURL": "https://api.att.com/3/messaging/outbound/22888026//MMSa9b4c6b76f957807/deliveryInfos"
    }
} 
Request Parameters
Parameter
Accept String Header
Specifies the format of the body for the response. The acceptable values for this parameter are:
  • application/json
  • application/xml
The default value is application/json.
Authorization String Header
Specifies the authorization. The acceptable format for this parameter is the word "Bearer" followed by a space ( ) and an OAuth access token. If this parameter value is missing from the header, then the API Gateway returns a message with an HTTP status code of 400 Invalid Request. If the OAuth access token is not valid, then the API Gateway returns an HTTP status code of 401 Unauthorized with a WWW-Authenticate HTTP header.
Content-Type String Header
Specifies the representation format for the request.
requestId String ResourceURL
Specifies the MMS message ID that is returned as part of the MMS API response. This parameter is used for the GSMA OneAPI and the AT&T version of the MMS API.
senderAddress String ResourceURL
Specifies the address that originally appeared on the AT&T Wireless customer's mobile device and to where a responding MMS message from the user is sent. This parameter should be one of the short codes assigned to the app account from which the originating message is sent.>
Response Parameters
Parameter
deliveryInfoList deliveryInfoList object Body
Specifies a list of one or more deliveryInfo parameters that describe the delivery status of the messages that was submitted by the app and previously accepted by the API Gateway.
deliveryInfo DeliveryInfo Object Body
Specifies the destination address and delivery status. This parameter is a child of the deliveryInfoList parameter.
address String Body
Specifies the URI being used to provide network delivery status of the sent message. This parameter is a child of the deliveryInfo parameter.
deliveryStatus String Body
Specifies the status of the MMS message that is delivered. The acceptable values for this parameter are:
  • DeliveredToNetwork : The message is delivered to the network, but not yet delivered to the user's mobile device.
  • DeliveredToTerminal : The message is successfully delivered to the user's mobile device.
  • DeliveryImpossible : The message is not successful delivered, such as when the message is not delivered before it expires.
  • MessageWaiting : The message is still queued for delivery. This is a temporary state, pending the transition to one of the delivery states.
This parameter is a child of the deliveryInfo parameter.
resourceURL anyURI Body
Specifies the endpoint URI serving the request. This parameter is a self-referring URI. This parameter is a child of the deliveryInfoList parameter.
Receive MMS
Overview

The Receive MMS callback receives MMS messages. This callback represents a push or notification that the developer must implement and host in order to collect all of the messages destined for the short code assigned to app account. This callback does not provide a mechanism to actively retrieve or poll for waiting MMS messages. When an MMS messages arrives for the short code, the API Gateway determines which app account is associated with that short code, and the MMS message is immediately delivered to the MMS Mobile Originated (MO) URI listener that is registered to the app account for the specified short code. This callback enables developers to immediately receive MO MMS messages destined to short codes assigned to their app account. In this case, the API Gateway acts as a client and the app acts as a server. The developer exposes the app functionality to the API Gateway in the form of a URI listener. This URI is used by the API Platform to forward the received MMS messages. Note: The developer must register the URI or the API Gateway will not be able push the notification to the app associated with the MO messages destined for the short code. Note: If the URI provided is HTTPS and a port is not defined, then the default SSL port 443 is used. Note: The use of a transport mechanism other than HTTPS is not supported in the URI. When a user sends a message to the short code, the API Gateway forwards the message to the URI listener provisioned with the short code associated with the app account. The messages are removed from the AT&T Network after delivery is acknowledged by the app or after all the retries as per the retry configuration are exhausted. The number of retries are specified by the retry configuration. The app must acknowledge the notification with an appropriate HTTP Status Code class of 2xx. Note: The following is an explanation regarding the handling of HTTP status codes sent by the app in response to a notification from the API Gateway.

  • In the case of HTTP Status Code class of 2xx, the API Gateway assumes positive acknowledgement that the notification has been sent successfully.
  • In the case of no response, timeout condition, or HTTP Status Codes class other than 2xx; the API Gateway assumes that either the app is temporarily unavailable or cannot receive and process the notification at this point in time.

If the app MMS Mobile Originated (MO) URI listener is unavailable, busy, or otherwise unable to process and acknowledge the MO message, then the delivery is retried as per the retry configuration set in the AT&T Network. Typically the retry period is 72 hours after which time the message will be discarded and no further retries are attempted.

  • OAuth Scope
  • Scope: Not applicable

  • Model: Not applicable

  • Resource
  • copy
    /{{notification_callback_uri}}
Examples

Request

copy
POST /your_callback
Content-Type: multipart/related; type="text/xml"; start="<rootpart@api.att.com>"; boundary="MIMEBoundary_a9b1d81c790c90ac6520a984a9e404cedce0f820564bd221"
Content-Transfer-Encoding: 8bit
Content-ID: rootpart@api.att.com
Content-Type: text/xml; charset=UTF-8

<InboundMmsMessage>
    <SenderAddress>tel:+14258028620</SenderAddress>
    <Priority>Normal</Priority>
    <Subject></Subject>
</InboundMmsMessage>

--MIMEBoundary_a9b1d81c790c90ac6520a984a9e404cedce0f820564bd221
Content-Type: multipart/related; Type="application/smil"; Start=0.smil; boundary="Nokia-mm-messageHandler-BoUnDaRy-=_-861381851"
Content-Transfer-Encoding: binary
Content-ID: <#1Attachment>

--Nokia-mm-messageHandler-BoUnDaRy-=_-861381851
Content-Type: application/smil
Content-ID: 0.smil
Content-Transfer-Encoding: BASE64

PHNtaWw+CjxoZWFkPgo8bGF5b3V0PgogPHJvb3QtbGF5b3V0Lz4KPHJlZ2lvbiBpZD0iVGV4dCIg
dG9wPSI3MCUiIGxlZnQ9IjAlIiBoZWlnaHQ9IjMwJSIgd2lkdGg9IjEwMCUiIGZpdD0ic2Nyb2xs
Ii8+CjxyZWdpb24gaWQ9IkltYWdlIiB0b3A9IjAlIiBsZWZ0PSIwJSIgaGVpZ2h0PSI3MCUiIHdp
ZHRoPSIxMDAlIiBmaXQ9Im1lZXQiLz4KPC9sYXlvdXQ+CjwvaGVhZD4KPGJvZHk+CjxwYXIgZHVy
PSIxMHMiPgo8aW1nIHNyYz0iSU1HXzcxMTguanBnIiByZWdpb249IkltYWdlIi8+Cjx0ZXh0IHNy
Yz0idGV4dF8wMDAyLnR4dCIgcmVnaW9uPSJUZXh0Ii8+CjwvcGFyPgo8L2JvZHk+Cjwvc21pbD4K

--Nokia-mm-messageHandler-BoUnDaRy-=_-861381851
Content-Type: image/jpeg; Name=IMG_7118.jpg
Content-Disposition: Attachment; Filename=IMG_7118.jpg
Content-ID: 1
Content-Location: IMG_7118.jpg
Content-Transfer-Encoding: BASE64

{{...BASE64 data....}}

--Nokia-mm-messageHandler-BoUnDaRy-=_-861381851
Content-Type: text/plain; Charset=US-ASCII
Content-Disposition: Attachment; Filename=text_0002.txt; Charset=US-ASCII
Content-ID: 2
Content-Location: text_0002.txt
Content-Transfer-Encoding: BASE64

U3VwZXI=
Request Parameters
Parameter
SenderAddress String Body
Specifies the originating customer's MSISDN. The format for this parameter is the protocol identifier followed by the URL-escaped AT&T mobile number, such as tel%3A%2B16309700001, tel%3A16309700001, or tel%3A6309700001.
Subject String Body
Specifies the subject of the message.
Priority String Body
Specifies the priority of the message. The acceptable values for this parameter are:
  • Default
  • Low
  • Normal
  • High
Attachments MIME multipart MIME Body Multipart
Specifies the media file or pieces of files represented as one or more multipart MIME content attachments containing text, image, video, or audio sent in the request body with the appropriate content-header for the specific part. The body of the request may contain one or more MIME multiple parts up to 600 kilobytes ( kB ). This parameter may contain audio, video, image, or textual content.
Response Parameters
Parameter
HTTP Response HTTP Response String Header
Specifies the HTTP response.
Receive MMS Delivery Status
Overview

The Receive MMS Delivery Status callback receives notifications for the final delivery status of the MMS messages sent by the app. This callback enables the developer to receive notifications. In this case, the API Gateway acts as a client and the app acts as a server. The developer provides the app listener endpoint to the API Platform during the app account registration process or with an update to their app account using the appropriate short code. A one-to-one association exists between the URI and a short code. The URI is used by the API Gateway to notify the final delivery status of the MMS messages that were earlier accepted for delivery by the API Gateway against the short code. Note: The delivery notification is delivered to the app only if the notification specified in the Send MMS method request by setting the notifyDeliveryStatus parameter to true. Note: There is one notification message per destination address when the MMS message is being delivered to multiple recipients in a single request. Note: All of the notifications being delivered to multiple recipients in a single request may not be delvered at the same time as the timing depends on the delivery of the MMS message to each recipient. Note: If the URI provided is HTTPS and a port is not specified, then the default SSL port 443 is used. Note: The use of a transport mechanism other than HTTPS is not supported in the URI. When an MMS message, that was earlier accepted for delivery, reaches the final status and the app has requested for delivery notification in the Send MMS method request; then one or more notification messages are sent to the endpoint URI registered by the app account for the specified short code. The MMS message reaches the final status when it is delivered to the user's mobile device or when it expires in the network after multiple retries. The number of retry attempts is based on the Network retry configuration, which is currently set to 72 hours. If the notifyDeliveryStatus parameter value is set to true in the Send MMS method request and if the notification endpoint URI is not provided or is associated to the corresponding short code in the app account, then the delivery notification status message may become lost. The app listener is expected to respond to the notification by responding with the appropriate HTTP Status Code class of 2xx for positive acknowledgement. The following is an explanation regarding handling of HTTP status codes sent by the app, in response to a notification from the API Gateway.

  • In case of HTTP Status Code class of 2xx, the API Gateway assumes positive acknowledgement that the notification has been sent successfully.
  • In case of no response, a timeout condition, or a HTTP Status Code class other than 2xx; the API Gateway assumes that either the app is temporarily unavailable or cannot receive and process the notification at that point in time.

If the registered app delivery notification URI listener is unavailable, busy, or otherwise unable to process and acknowledge the delivery status notification message; then delivery is retried as per the retry configuration set in the API Platform. Typically, the retry period is 72 hours after which the message is discarded and no further retries are attempted.

  • OAuth Scope
  • Scope: Not applicable

  • Model: Not applicable

  • Resource
  • copy
    /{{notification_callback_uri}}
Examples

Request

copy
POST /{{notification_callback_uri}}
{
    "deliveryInfoNotification": {
        "messageId":"MMSc04091ed284f5684", "deliveryInfo":{
            "address":"tel:+13500000012", "deliveryStatus":"DeliveredToTerminal"
        }
    }
}
Request Parameters
Parameter
address String Body
Specifies the mobile number of the original recipient of the MMS message sent by the app. This parameter is a child of the deliveryInfo parameter.
deliveryInfo DeliveryInfo Object Body
Specifies the delivery status for the given destination address. This parameter is a child of the deliveryInfoNotification parameter.
deliveryInfoNotification DeliveryInfoNotification Object Body
Specifies the delivery status for one or more destination addresses along with callback data originally passed by the app in the Send MMS method request and the unique tracking ID generated by the API Gateway that was earlier provided back to the app in a response to the original Send MMS method request.
deliveryStatus String Body
Specifies the delivery status for the destination address. The acceptable values for this parameter are:
  • DeliveredToTerminal
  • DeliveryImpossible
  • DeliveryUncertain
This parameter is a child of the deliveryInfo parameter.
Response Parameters
Parameter
N/A N/A N/A
N/A
Send MMS

Select provider:

Overview

The Send MMS method sends an MMS message to one or more AT&T Wireless mobile devices. This method also allows the app to specify to the API Gateway that it be notified about the delivery status of the message through a push or callback response.

  • OAuth Scope
  • Scope: MMS

  • Model: client_credentials

  • Resource
  • copy
    POST https://api.att.com/mms/v3/messaging/outbox
Examples

Request

copy
POST mms/v3/messaging/outbox HTTP/1.1
Authorization: Bearer xyz123456789
Content-Type: multipart/related; type="application/json"; start="{startpart}"; boundary="foo"
Accept: application/json
MIME-Version: 1.0
Content-Length: nnnn
Connection: close

--foo
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="root-fields"
Content-ID: {startpart}
Content-Type: application/json

{
    "outboundMessageRequest": {
        "address":"tel:4259999999",
        "priority":"High",
        "subject":"simple message to myself"
    }
}
--foo
Content-Disposition: attachment; filename=att.gif
Content-Transfer-Encoding: Binary
Content-ID: att.gif
Content-Type: image/gif;name=att.gif

{{binary data}}
--foo--

Response

copy
{
    "outboundMessageResponse": {
        "messageId": "MMSa9b4dd85737c0409",
        "resourceReference": {
            "resourceURL": "https://api.att.com/mms/v3/messaging/outbox/MMSa9b4dd85737c0409"
        }
    }
} 

Request

copy
POST mms/v3/messaging/outbox HTTP/1.1
Accept: application/json
MIME-Version: 1.0
Content-Type: multipart/related; type="application/json"; start="{startpart}"; boundary="----=_Part_1_30913058.1330958564625"
Content-Length: nnnnn

------=_Part_1_30913058.1330958564625
Content-Type: application/json; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: {startpart}

{
    "outboundMessageRequest": {
        "address":"tel:14259999999",
        "subject":"Test MMS V3",
        "priority":"High"
    }
}
------=_Part_1_30913058.1330958564625
Content-Type: multipart/related; type="application/smil"; start="{smil}"; boundary="----=_Part_0_15555997.1330958564590"
Content-Transfer-Encoding: binary
Content-ID: {#1Attachment}

------=_Part_0_15555997.1330958564590
Content-Type: application/smil; name=mms.smil
Content-Transfer-Encoding: 8bit
Content-ID: {smil}
Content-Disposition: attachment; filename=mms.smil

<?xml version="1.0" encoding="UTF-8"?>
<smil>
    <head>
        <layout>
            <root-layout height="100%" width="100%"/>
            <region fit="hidden" height="50%" id="ImageOrVideo" left="0" top="50%" width="100%"/>
            <region fit="hidden" height="50%" id="Text" left="0px" top="50%" width="100%"/>
        </layout>
    </head>
    <body>
        <par>
            <img region="ImageOrVideo" src="cid:0-image"/>
            <text region="Text" src="cid:0-text"/>
        </par>
    </body>
</smil>
------=_Part_0_15555997.1330958564590
Content-Type: text/plain; name=text.txt; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-ID: 0-text
Content-Disposition: attachment; filename=text.txt

Test MMS from Developers
------=_Part_0_15555997.1330958564590
Content-Type: image/png; name=atttst.png
Content-Transfer-Encoding: BASE64
Content-ID: 0-image
Content-Disposition: attachment; filename=atttst.png

{{BASE64 encoded Data}}
------=_Part_0_15555997.1330958564590--

------=_Part_1_30913058.1330958564625--

Response

copy
{
    "outboundMessageResponse": {
        "messageId": "MMSa9b4dd85737c0409"
    }
} 

Request

copy
POST mms/v3/messaging/outbox HTTP/1.1
Authorization: Bearer xyz123456789
Content-Type: multipart/related; type="application/xml"; start="{startpart}"; boundary="foo"
Accept: application/json
MIME-Version: 1.0
Content-Length: nnnn
Connection: close


--foo
Content-Type:; application/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="root-fields"
Content-ID: {startpart}

<outboundMessageRequest>
    <address>tel:+13500000992</Address>
    <subject>test</Subject>
    <priority>High</Priority>
</outboundMessageRequest>
--foo
Content-Disposition: attachment; filename=att.gif
Content-Transfer-Encoding: Binary
Content-ID: att.gif
Content-Type: image/gif;name=att.gif

{{binary data}}
--foo-- 

Response

copy
<outboundMessageResponse messageId="MMSc04091ed284f5684">
    <resourceReference>
       <resourceURL>https://api.att.com/mms/v3/messaging/outbox/MMSa9b4dd85737c0409</resourceUrl>
    </resourceReference>
</outboundMessageResponse> 

Request

copy
POST mms/v3/messaging/outbox HTTP/1.1
Authorization: Bearer xyz123456789
Content-Type: multipart/related; type="application/x-www-form-urlencoded"; start="{startpart}"; boundary="foo"
Accept: application/json
MIME-Version: 1.0
Content-Length: nnnn
Connection: close


--foo
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="root-fields"
Content-ID: {startpart}
Content-Type: application/x-www-form-urlencoded

address=tel%3A%2B13500000991&
priority=High&
subject=image%20file
--foo
Content-Disposition: attachment; filename=att.gif
Content-Transfer-Encoding: Binary
Content-ID: att.gif
Content-Type: image/gif;name=att.gif

{{binary data}}
--foo-- 

Response

copy
<outboundMessageResponse messageId=?MMSa9b1927803784049?>
</outboundMessageResponse> 
Request Parameters
Parameter
Accept String Header
Specifies the format of the body for the response. The acceptable values for this parameter are:
  • application/json
  • application/xml
  • application/x-www-form-urlencoded
The default value is application/json.
Authorization String Header
Specifies the authorization. The acceptable format for this parameter is the word "Bearer" followed by a space ( ) and an OAuth access token. If this parameter value is missing from the header, then the API Gateway returns a message with an HTTP Status Code of 400 Invalid Request. If the OAuth access token is not valid, then the API Gateway returns an HTTP Status Code of 401 Unauthorized with a WWW-Authenticate HTTP header.
Content-Type String Header
Specifies the representation format for the body of the request.
outboundMessageRequest OutboundMessageRequest Object Body
Specifies the first of the multipart MIME content in the body of request message encapsulating all of the root-level parameters.
address String Body
Specifies one or more mobile numbers for AT&T Wireless customers that act as the destinations of the message. This parameter must be set to the MSISDN preceded by the protocol identifier tel:. The country code and preceding plus sign ( + ) are optional. The format for the parameter may be one of the following:
  • tel:+16309700001
  • tel:16309700001
  • tel:6309700001
Note: If the Content-Type parameter is set to application/x-www-form-url-encoded; then this parameter value should be URL encoded, such as address=tel%3A%2B16309700001. Note: The maximum number of recommended and supported destination addresses in a single message is 10. This parameter is a child of the outboundMMSRequest parameter.
subject String Body
Specifies the subject for message being sent. This parameter is a child of the outboundMMSRequest parameter.
priority String Body
Specifies the priority of the message. The acceptable values for this parameter are:
  • Default
  • Low
  • Normal
  • High
This parameter is a child of the outboundMMSRequest parameter.
notifyDeliveryStatus Boolean Body
Indicates that the delivery status notification is expected by the app. The acceptable values for this parameter are:
  • true : The API Gateway sends a push notification to communicate the final delivery status of the message. The notification is sent to the endpoint URI registered to the app account for the specified short code. If there is more than one recipient specified in the address parameter, then there is one notification per recipient. Note: If this parameter is set to true, but the developer has not registered any endpoint URI against the specified short code; then a bad request error is sent in the response.
  • false : The app does not receive any delivery status notifications from the API Gateway.
This parameter is a child of the outboundMMSRequest parameter.
Attachments MIME body multipart MIME Body Multipart
Specifies the media file or pieces of files represented as one or more multipart MIME content attachments containing text, image, video, or audio sent in the request body with the appropriate content-header for the specific part. Note: The SMIL wrapping is recommended in order to render the multi-media attachments properly across all the mobile devices. If an SMIL wrapper is not specified by the developer, the API Gateway inserts the SMIL wrapper as appropriate.
Response Parameters
Parameter
outboundMessageResponse OutboundMessageResponse Object Body
Specifies the body of the response that encapsulates all the root-level parameters of this response message.
messageId String Body
Specifies a unique identifier for the message.This unique message identifier would have two different purposes based on the scenario.
  • When the notifyDeliveryStatus parameter is either set to false or not present in the request, this parameter value would be used as a parameter in the URI on the Get MMS Delivery Status method request to obtain the delivery status of the message.
  • When the notifyDeliveryStatus parameter is set to true in the request, this parameter value is reflected in the delivery status callback notification sent to the registered app listener.
This parameter is a child of the outboundMMSResponse parameter.
resourceReference ResourceReference Object Body
Specifies the location resource URI of the created resource. Note: This parameter is only present in the response when the notifyDeliveryStatus parameter is either set to false or not set in the request. This parameter is a child of the outboundMMSResponse parameter.
resourceURL anyURI Body
Specifies the location of the created resource for checking the delivery status of the sent messages. This parameter is a child of the resourceReference parameter.
4. Quickstart
copy
#Get Access Token via OAuth. 
#Replace {{CLIENT_ID}} and {{CLIENT_SECRET}} with your key and secret.
curl https://api.att.com/oauth/token \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --header "Accept: application/json" \
    --data "client_id={{CLIENT_ID}}&client_secret={{CLIENT_SECRET}}&scope=MMS&grant_type=client_credentials" \
    --request POST

#Refresh an Access Token.
#Replace {{REFRESH_TOKEN}} with the refresh token from OAuth.
curl "https://api.att.com/oauth/token" \
    --header "Content-Type: application/x-www-form-urlencoded" \
    --header "Accept: application/json" \
    --data "client_id={{CLIENT_ID}}&client_secret={{CLIENT_SECRET}}&scope=MMS&grant_type=client_credentials&refresh_token={{REFRESH_TOKEN}}" \
    --request POST

#Send Message
#Replace {{ACCESS_TOKEN}} with your access token.
#Replace {{PATH_TO_FILE}} with the path to your request file.
curl "https://api.att.com/mms/v3/messaging/outbox"
    --header "Authorization: Bearer {{ACCESS_TOKEN}}" \
    --header "Accept: application/json" \
    --header "MIME-Version: 1.0" \
    --header "Content-Type: multipart/related;type=\"application/json\";start=\"<startpart>\"; boundary=\"foo\"" \
    --data-binary @{{PATH_TO_FILE}} \
    --request POST

#In a separate request text file:
#Replace {{IMAGE_DATA}} with the raw binary file data.
--foo
Content-Transfer-Encoding: 8bit
Content-Disposition: form-data; name="root-fields"
Content-ID: <startpart>
Content-Type: application/json

{
    "outboundMessageRequest":{
        "address":"tel:1234567890",
        "priority":"High",
        "subject":"simple message to myself"
    }
}

--foo
Content-Disposition: attachment; filename=att.gif
Content-Transfer-Encoding: Binary
Content-ID: att.gif
Content-Type: image/gif;name=att.gif

{{IMAGE_DATA}}
--foo--
copy
package com.att.example;
// Import the relevant code kit parts
import com.att.api.mms.service.MMSService;
import com.att.api.oauth.OAuthService;
import com.att.api.oauth.OAuthToken;
import com.att.api.rest.RESTException;
public class App {
    private static void setProxySettings() {
        // set any proxy settings
        //RESTConfig.setDefaultProxy("proxy.host", 8080);
    }
    public static void main(String[] args) {
        try {
            setProxySettings();
            // Use the app settings from developer.att.com for the following
            // values. Make sure MMS is enabled for the app key/secret.

            final String fqdn = "https://api.att.com";
            // Enter the value from 'App Key' field
            final String clientId = "ENTER VALUE!";
            // Enter the value from 'Secret' field
            final String clientSecret = "ENTER VALUE!";
            // Create service for requesting an OAuth token
            OAuthService osrvc = new OAuthService(fqdn, clientId, clientSecret);
            // Get OAuth token using the MMS scope
            OAuthToken token = osrvc.getToken("MMS");
            // Create service for interacting with the MMS api
            MMSService mmsSrvc = new MMSService(fqdn, token);
            // Phone number
            final String pn = "5555555555";
            // Set attachments
            final String[] attachments = { "/tmp/att.gif" };
            MMSService.sendMMS(pn, attachments, "subject", null, false);
        } catch (RESTException re) {
            // handle exceptions here
            re.printStackTrace();
        } finally {
            // perform any clean up here
        }
    }
}
copy
<?php
// make sure this index.php file is in the same directory as the 'lib' folder.
require_once __DIR__ . '/lib/OAuth/OAuthTokenService.php';
require_once __DIR__ . '/lib/MMS/MMSService.php';
// use any namespaced classes
use Att\Api\OAuth\OAuthTokenService;
use Att\Api\MMS\MMSService;
// Use the app settings from developer.att.com for the following values.
// Make sure MMS is enabled the app key/secret.
// Enter the value from 'App Key' field
$clientId = 'ENTER VALUE!';
// Enter the value from 'Secret' field
$clientSecret = 'ENTER VALUE!';
// Enter phone number that MMS will be sent to
// For example: $number = '5555555555';
$number = 'ENTER VALUE!';
// Enter file path of attachment to send (or null if none)
// For example, $fname = '/tmp/image.gif'; or $fname = null;
$fname = 'ENTER VALUE';
// Create service for requesting an OAuth token
$osrvc = new OAuthTokenService('https://api.att.com', $clientId, $clientSecret);
// Get OAuth token using the MMS scope
$token = $osrvc->getToken('MMS');
// Create service for interacting with the MMS api
$mmsSrvc = new MMSService('https://api.att.com', $token);
// Send an MMS to the specified number with the specified attachment
$response = $mmsSrvc->sendMMS($number, array($fname));
?>
<!DOCTYPE html>
<html>
  <head>
    <title>AT&amp;T MMS Example</title>
  </head>
  <body>
  Message Id: <?php echo htmlspecialchars($response->getMessageId()); ?>
  </body>
</html>
copy
#!/usr/bin/env ruby
# Make sure the att-codekit has been installed then require the class
require 'att/codekit'
# Include the name spaces to reduce the code required (Optional)
include Att::Codekit
# Uncomment to set a proxy if required
# Transport.proxy("http:/proxyaddress.com:port")
# Use the app settings from developer.att.com for the following values.
# Make sure MMS is enabled for the app key/secret.
# Enter the path of a file to send
ATTACHMENT = '/tmp/somefile.png'
# Enter the value from 'App Key' field
client_id = 'ENTER VALUE!'
# Enter the value from 'Secret' field
client_secret = 'ENTER VALUE!'
# Set the fqdn to default of https://api.att.com
fqdn = 'https://api.att.com'
# Create service for requesting an OAuth token
clientcred = Auth::ClientCred.new(fqdn,
                                  client_id,
                                  client_secret)
# Get OAuth token using the MMS scope
token = clientcred.createToken('MMS')
# Create service for interacting with the MMS api
mms = Service::MMSService.new(fqdn, token)
# Setup the addresses that we want to send 
addresses = "555-555-5555,444-555-5555"
# Alternatively we can use an array
# addresses = [5555555555,"444-555-5555"]
# Use exception handling to see if anything went wrong with the request
begin
  # Send a message to the addresses specified
  response = mms.sendMms(addresses, "Example", ATTACHMENT)
  status = mms.mmsStatus(response.id)
rescue Service::ServiceException => e
  # There was an error in execution print what happened
  puts "There was an error, the api returned the following error code:"
  puts "#{e.message}"
else
  puts "Sent MMS with id: #{response.id}"
  puts "#{response.id} has the resource url: #{response.resource_url}"
  puts ""
  puts "Status response:"
  puts "\tResource URL: #{status.resource_url}"
  puts "\tDelivery Info:"
  status.delivery_info.each do |info|
    puts "\t\t------------------------"
    puts "\t\tMessage ID: #{info.id}"
    puts "\t\tAddress: #{info.address}"
    puts "\t\tStatus: #{info.status}"
    puts "\t\t------------------------"
  end
end
copy
//List of using alias to make it easier to qualify an identifier to a namespace or type
using System;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Web;
using System.Web.Script.Serialization;

/*
 * PREREQUISITE:  Use .Net C# Web Site Project.
 * An ASP.NET page is typically divided into two files:
 *         A markup file with a .aspx extension
 *         A code file, with a .aspx.cs extension
 * This code defines a partial class named MMS (Class name
 * can be replaced with the name of the page happens to be for you).
 * For more information about OAuth or MMS Service parameters, refer to online 
 * documentation at https://developer.att.com.
 */

public partial class MMS : System.Web.UI.Page
{
    string apiResponseString = string.Empty;   //successful response of api request
    string apiErrorResponse = string.Empty;    //error response of api request

    /* The Page_Load event is triggered when a page loads, and ASP.NET will 
     * automatically call the subroutine Page_Load, and execute the code 
     * inside it.
     */
    protected void Page_Load(object sender, EventArgs e)
    {
        /*If the application is deployed behind the proxy, add the value
         * of the proxy IP and Port, otherwise leave it as it is.
         */
        string proxyIp = "";
        int proxyPort = 0;

        //BypassCertificateError();  //Uncomment to ignore one way ssl handshake errors.

        // Get Access Token Start
        string oAuthEndPoint = "https://api.att.com/oauth/token";
        string oAuthHTTPVerb = "POST";
        string oAuthAccept = "application/json";
        string oAuthContentType = "application/x-www-form-urlencoded";
        string oAuthclient_id = ""; //Update with registered MMS Service Application Id/Key.
        string oAuthclient_secret = ""; //Update with registered MMS Service Secret Key/Id.
        string oAuthScope = "MMS";
        string oAuthBody = "client_id=" + HttpUtility.UrlEncode(oAuthclient_id).ToString() +
                                                "&client_secret=" + HttpUtility.UrlEncode(oAuthclient_secret).ToString() +
                                                "&grant_type=" + HttpUtility.UrlEncode("client_credentials").ToString() +
                                                "&scope=" + HttpUtility.UrlEncode(oAuthScope).ToString();
        // Send web request and handle web response 
        HttpWebRequest webRequest = null;
        HttpWebResponse webResponse = null;
        GetAccessTokenResponse getAccessTokenResponse = null;
        try
        {
            webRequest = (HttpWebRequest)System.Net.WebRequest.Create(oAuthEndPoint);
            if (!string.IsNullOrEmpty(proxyIp))
            {
                webRequest.Proxy = new WebProxy(proxyIp, proxyPort);
            }
            webRequest.ContentType = oAuthContentType;
            webRequest.Accept = oAuthAccept;
            webRequest.Method = oAuthHTTPVerb;
            byte[] postBytes = null;
            if (!string.IsNullOrEmpty(oAuthBody))
            {
                UTF8Encoding encoding = new UTF8Encoding();

                postBytes = encoding.GetBytes(oAuthBody);
            }
            if (postBytes != null)
            {
                webRequest.KeepAlive = true;
                webRequest.ContentLength = postBytes.Length;
                Stream postStream = webRequest.GetRequestStream();
                postStream.Write(postBytes, 0, postBytes.Length);
                postStream.Close();
            }

            webResponse = (HttpWebResponse)webRequest.GetResponse();
            using (StreamReader sr2 = new StreamReader(webResponse.GetResponseStream()))
            {
                apiResponseString = sr2.ReadToEnd();
                getAccessTokenResponse = new GetAccessTokenResponse();
                JavaScriptSerializer deserializeJsonObject = new JavaScriptSerializer();
                getAccessTokenResponse = (GetAccessTokenResponse)deserializeJsonObject.Deserialize(apiResponseString, typeof(GetAccessTokenResponse));
                sr2.Close();
            }
            webRequest = null;
            webResponse.Close();
            // Get Access Token End 

            // Send MMS Start
            // Update <number> with AT&T subscriber number.
            string mmsAddress = "address=" + Server.UrlEncode("tel:+1<Number>") + "&" + "address=" + Server.UrlEncode("tel:+1<Number>");
            string mmsFile = Request.MapPath("~\\attachments\\att.gif"); //Update with the location of file
            string mmsContentType = "image/gif";   //Update content type based on the type of attachment
            string mmsMessage = "Startup Guide";
            bool mmsNotify = false;
            string mmsServiceEndPoint = "https://api.att.com/mms/v3/messaging/outbox";
            string mmsServiceHTTPVerb = "POST";
            string mmsServiceAccept = "application/json";
            string mmsServiceAuthorization = getAccessTokenResponse.access_token;
            NameValueCollection headers = new NameValueCollection();
            headers.Add("Authorization", "Bearer " + mmsServiceAuthorization);
            string boundary = "----------------------------" + DateTime.Now.Ticks.ToString("x");
            webRequest = (HttpWebRequest)System.Net.WebRequest.Create(mmsServiceEndPoint);
            if (!string.IsNullOrEmpty(proxyIp))
            {
                webRequest.Proxy = new WebProxy(proxyIp, proxyPort);
            }
            webRequest.Accept = mmsServiceAccept;
            webRequest.Method = mmsServiceHTTPVerb;
            webRequest.Headers.Add(headers);
            webRequest.ContentType = "multipart/related; type=\"application/x-www-form-urlencoded\"; start=\"<startpart>\"; boundary=\"" + boundary + "\"\r\n";
            webRequest.KeepAlive = true;
            UTF8Encoding mmsEncoding = new UTF8Encoding();
            byte[] totalpostBytes = mmsEncoding.GetBytes(string.Empty);
            string sendMMSData = mmsAddress + "&subject=" + Server.UrlEncode(mmsMessage) + "&notifyDeliveryStatus=" + mmsNotify;

            string data = string.Empty;
            data += "--" + boundary + "\r\n";
            data += "Content-Type: application/x-www-form-urlencoded;charset=UTF-8\r\nContent-Transfer-Encoding: 8bit\r\nContent-Disposition: form-data; name=\"root-fields\"\r\nContent-ID:<startpart>\r\n\r\n" + sendMMSData;// +"\r\n";
            totalpostBytes = this.FormMIMEParts(boundary, data, mmsFile, mmsContentType);

            byte[] byteLastBoundary = mmsEncoding.GetBytes("\r\n--" + boundary + "--\r\n");
            int totalSize = totalpostBytes.Length + byteLastBoundary.Length;

            var totalMS = new MemoryStream(new byte[totalSize], 0, totalSize, true, true);
            totalMS.Write(totalpostBytes, 0, totalpostBytes.Length);
            totalMS.Write(byteLastBoundary, 0, byteLastBoundary.Length);

            byte[] finalpostBytes = totalMS.GetBuffer();
            webRequest.ContentLength = finalpostBytes.Length;
            Stream mmsPostStream = webRequest.GetRequestStream();
            mmsPostStream.Write(finalpostBytes, 0, finalpostBytes.Length);
            mmsPostStream.Close();
            webResponse = (HttpWebResponse)webRequest.GetResponse();
            using (StreamReader sr2 = new StreamReader(webResponse.GetResponseStream()))
            {
                apiResponseString = sr2.ReadToEnd();
                JavaScriptSerializer deserializeJsonObject = new JavaScriptSerializer();
                SendMMSResponse sendMMSResponseData = new SendMMSResponse();
                sendMMSResponseData.outboundMessageResponse = new OutBoundMMSResponse();
                sendMMSResponseData.outboundMessageResponse.resourceReference = new ResourceReference();
                sendMMSResponseData = (SendMMSResponse)deserializeJsonObject.Deserialize(apiResponseString, typeof(SendMMSResponse));
                sr2.Close();
            }
            // Send MMS End
        }
        catch (WebException ex)
        {
            try
            {
                if (null != ex.Response)
                {
                    using (StreamReader sr2 = new StreamReader(ex.Response.GetResponseStream()))
                    {
                        apiErrorResponse = sr2.ReadToEnd();
                        sr2.Close();
                    }
                }
            }
            catch
            {
                apiErrorResponse = "Unable to get response";
            }
        }
        catch (Exception ex)
        {
            apiErrorResponse = ex.ToString();
        }
        finally
        {
            webRequest = null;
            if (webResponse != null)
                webResponse.Close();
            webResponse = null;
        }

    }

    #region MMSSubroutines

    /// <summary>
    /// Form mime parts for the user input files
    /// </summary>
    /// <param name="boundary">string, boundary data</param>
    /// <param name="data">string, mms message</param>
    /// <returns>returns byte array of files</returns>
    private byte[] FormMIMEParts(string boundary, string data, string mmsFile, string contentType)
    {
        UTF8Encoding encoding = new UTF8Encoding();

        byte[] postBytes = encoding.GetBytes(string.Empty);
        byte[] totalpostBytes = encoding.GetBytes(string.Empty);

        byte[] Head = encoding.GetBytes(data);
        int totalSizeWithHead = totalpostBytes.Length + Head.Length;

        var totalMSWithHead = new MemoryStream(new byte[totalSizeWithHead], 0, totalSizeWithHead, true, true);
        totalMSWithHead.Write(totalpostBytes, 0, totalpostBytes.Length);
        totalMSWithHead.Write(Head, 0, Head.Length);
        totalpostBytes = totalMSWithHead.GetBuffer();
        string filename = Path.GetFileName(mmsFile);
        postBytes = this.GetBytesOfFile(boundary, mmsFile, filename, contentType);
        var msOne = this.JoinTwoByteArrays(totalpostBytes, postBytes);
        totalpostBytes = msOne.GetBuffer();

        return totalpostBytes;
    }

    // <summary>
    /// This function adds two byte arrays
    /// </summary>
    /// <param name="firstByteArray">first array of bytes</param>
    /// <param name="secondByteArray">second array of bytes</param>
    /// <returns>returns MemoryStream after joining two byte arrays</returns>
    private MemoryStream JoinTwoByteArrays(byte[] firstByteArray, byte[] secondByteArray)
    {
        int newSize = firstByteArray.Length + secondByteArray.Length;
        var ms = new MemoryStream(new byte[newSize], 0, newSize, true, true);
        ms.Write(firstByteArray, 0, firstByteArray.Length);
        ms.Write(secondByteArray, 0, secondByteArray.Length);
        return ms;
    }

    // <summary>
    /// Gets the bytes representation of file along with mime part
    /// </summary>
    /// <param name="boundary">string, boundary message</param>
    /// <param name="data">string, mms message</param>
    /// <param name="filePath">string, filepath</param>
    /// <returns>byte[], representation of file in bytes</returns>
    private byte[] GetBytesOfFile(string boundary, string filePath, string filename, string contentType)
    {
        UTF8Encoding encoding = new UTF8Encoding();
        byte[] postBytes = encoding.GetBytes(string.Empty);
        FileStream fileStream = null;
        BinaryReader binaryReader = null;

        try
        {
            string attachmentContentType = contentType;
            fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read);
            binaryReader = new BinaryReader(fileStream);

            byte[] image = binaryReader.ReadBytes((int)fileStream.Length);

            string data = "\r\n--" + boundary + "\r\n";
            data += "Content-Disposition: attachment; filename=" + filename + "\r\n";
            data += "Content-Type: " + attachmentContentType + ";name=" + filename + "\r\n";
            data += "Content-ID: " + filename + "\r\n";
            data += "Content-Transfer-Encoding: Binary\r\n\r\n";

            byte[] firstPart = encoding.GetBytes(data);
            int newSize = firstPart.Length + image.Length;

            var memoryStream = new MemoryStream(new byte[newSize], 0, newSize, true, true);
            memoryStream.Write(firstPart, 0, firstPart.Length);
            memoryStream.Write(image, 0, image.Length);

            postBytes = memoryStream.GetBuffer();
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            if (null != binaryReader)
            {
                binaryReader.Close();
            }

            if (null != fileStream)
            {
                fileStream.Close();
            }
        }

        return postBytes;
    }
    #endregion

    #region IgnoreSSLHandshakeError
    private static void BypassCertificateError()
    {
        ServicePointManager.ServerCertificateValidationCallback +=
            delegate(Object sender1, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
            {
                return true;
            };
    }
    #endregion
    #region OAuthServiceDataStructures
    // OAuth Service Class
    class GetAccessTokenResponse
    {
        public string access_token { get; set; }
        public int expires_in { get; set; }
        public string refresh_token { get; set; }
        public string token_type { get; set; }
    }
    #endregion
    #region MMSDataStructures
    ///<summary>
    ///Class to hold ResourceReference
    ///</summary>
    public class ResourceReference
    {
        ///<summary>
        ///Gets or sets resourceURL
        ///</summary>
        public string resourceURL { get; set; }
    }

    public class SendMMSResponse
    {
        public OutBoundMMSResponse outboundMessageResponse;
    }
    // <summary>
    /// Class to hold send mms response
    /// </summary>
    public class OutBoundMMSResponse
    {
        // <summary>
        /// Gets or sets messageId
        /// </summary>
        public string messageId { get; set; }
        // <summary>
        /// Gets or sets ResourceReference
        /// </summary>
        public ResourceReference resourceReference { get; set; }
    }
    #endregion
}
5. Sample Apps