Amazon SES Raw Email Sending

AWS SES Raw Email Sending refers to the advanced capability in Amazon Simple Email Service that allows developers to craft and send fully customized email messages with complete control over every aspect of the email structure, format, and content.

What is Raw Email Sending?

Raw email sending in Amazon SES provides developers with direct control over the entire MIME structure, including headers, body parts, attachments, and encoding. Unlike the simplified sending methods that abstract away email complexity, raw email sending exposes the underlying email protocols and standards, allowing for maximum customization and flexibility.

This approach enables precise control over essential email components that affect deliverability, rendering, and recipient experience. According to the AWS documentation, raw email sending is particularly valuable for applications requiring sophisticated formatting, attachments, or custom headers that aren't available through simpler API methods.

How Raw Email Sending Works

The raw email sending process in SES follows a streamlined workflow where you first construct a complete MIME message with all required headers and body content, then transmit this message to AWS using either the SendRawEmail API operation or SMTP interface with proper encoding, after which AWS SES performs essential verification checks while minimizing alterations to your carefully crafted message, and finally manages the entire delivery process including retries, bounce handling, complaint processing, and delivery notification distribution according to the verified identity's configuration settings.

Common Use Cases

Raw email sending is particularly valuable in several scenarios:

Use CaseWhy Raw Sending Helps
Transactional Emails with AttachmentsSend order confirmations, invoices, or receipts with PDF attachments while maintaining precise branding and format control
Calendar InvitationsInclude properly formatted iCalendar (ICS) components that work reliably across email clients
Digitally Signed MessagesImplement S/MIME signatures for enhanced security and authentication in regulated industries
Custom Email HeadersAdd specialized headers for tracking, categorization, authentication, or internal routing purposes

Implementation Approaches

Raw email sending can be implemented through two primary interfaces:

SendRawEmail API: This programmatic approach allows sending raw messages through AWS SDK calls. It requires properly formatting the entire message according to MIME standards and encoding it as required by the API specification.

SMTP Interface: AWS SES provides an SMTP endpoint that can accept raw email messages. This approach is particularly useful for integrating with existing applications that already support SMTP as a sending method.

For both approaches, AWS recommends using established email libraries that handle the complexities of MIME formatting and encoding rather than attempting to construct raw messages manually. Libraries like Nodemailer for Node.js, JavaMail for Java, and email for Python provide robust capabilities for constructing standards-compliant raw messages.

Important Considerations

When implementing raw email sending, several factors require careful attention:

  • Standards Compliance: Raw emails must adhere strictly to email standards like RFC 5322 and MIME specifications. Non-compliant messages may be rejected by AWS SES or recipient mail servers.
  • Authentication Headers: Properly implementing authentication mechanisms like SPF, DKIM, and DMARC is especially important when sending raw emails.
  • Message Size Limits: AWS SES imposes a maximum size limit (currently 10MB) on raw messages, including all parts, headers, and attachments after base64 encoding.
  • Error Handling: Because raw emails offer more opportunities for formatting errors, robust error handling and testing are essential to ensure reliable delivery.

Frequently Asked Questions

When should I use raw email sending versus the simple API methods?

Use raw sending for advanced features like attachments or custom headers; simple APIs are best for basic emails.

Does raw email sending affect deliverability?

Yes, if not implemented correctly. Follow best practices to maintain good deliverability.

Can I use templates with raw email sending?

SES templates don’t work directly, but you can create your own templates for raw emails.

How do I track opens and clicks with raw email sending?

Manually add tracking pixels and rewrite links, or use a third-party tracking tool.

Send Consistent-looking & beautiful emails today!

Email communication is part of your product! Don't let it ruin your user's experience with your brand