AWS SDK Version 2 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

.NET Framework 4.5
Delivers a message to the specified queue. With Amazon SQS, you now have the ability to send large payload messages that are up to 256KB (262,144 bytes) in size. To send large payloads, you must use an AWS SDK that supports SigV4 signing. To verify whether SigV4 is supported for an AWS SDK, check the SDK release notes.

The following list shows the characters (in Unicode) allowed in your message, according to the W3C XML specification. For more information, go to If you send any characters not included in the list, your request will be rejected.

#x9 | #xA | #xD | [#x20 to #xD7FF] | [#xE000 to #xFFFD] | [#x10000 to #x10FFFF]

Namespace: Amazon.SQS
Assembly: AWSSDK.dll
Version: (assembly version)


public virtual SendMessageResponse SendMessage(
         SendMessageRequest request


Type: Amazon.SQS.Model.SendMessageRequest

Container for the necessary parameters to execute the SendMessage service method.

Return Value
Type: Amazon.SQS.Model.SendMessageResponse
The response from the SendMessage service method, as returned by SQS.


InvalidMessageContentsException The message contains characters outside the allowed set.
UnsupportedOperationException Error code 400. Unsupported operation.


This example shows how to send a message.

Send message example

var client = new AmazonSQSClient();

var request = new SendMessageRequest
  DelaySeconds = (int)TimeSpan.FromSeconds(5).TotalSeconds,
  MessageAttributes = new Dictionary<string, MessageAttributeValue>
      "MyNameAttribute", new MessageAttributeValue 
        { DataType = "String", StringValue = "John Doe" }
      "MyAddressAttribute", new MessageAttributeValue 
        { DataType = "String", StringValue = "123 Main St." }
      "MyRegionAttribute", new MessageAttributeValue 
        { DataType = "String", StringValue = "Any Town, United States" }
  MessageBody = "John Doe customer information.",
  QueueUrl = ""

var response = client.SendMessage(request);

Console.WriteLine("For message ID '" + response.MessageId + "':");
Console.WriteLine("  MD5 of message attributes: " +
Console.WriteLine("  MD5 of message body: " + response.MD5OfMessageBody);

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5