AWS SDK Version 3 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.

Delivers a message to the specified queue.

A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed:

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

Any characters not included in this list will be rejected. For more information, see the W3C specification for characters.


For .NET Core this operation is only available in asynchronous form. Please refer to SendMessageAsync.

Namespace: Amazon.SQS
Assembly: AWSSDK.SQS.dll
Version: 3.x.y.z


public virtual SendMessageResponse SendMessage(
         SendMessageRequest request
Type: Amazon.SQS.Model.SendMessageRequest

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

Return Value
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

See Also