Amazon Simple Email Service (SES)
See Amazon Simple Email Service Developer Guide for general guidance using SES.
API Access
The primary interface for accessing Amazon SESV2 is through the ISESV2Client interface, which provides access to all SESV2 operations. The client handles authentication, request signing, and communication with the AWS SESV2 endpoints.
program SendEmail;
uses
AWS.SESV2;
var
Client: ISESV2Client;
Request: ISESV2SendEmailRequest;
Response: ISESV2SendEmailResponse;
SimpleMessage: ISESV2Message;
begin
Client := TSESV2Client.Create;
// Create and prepare a message.
SimpleMessage := TSESV2Message.Create('Subject...', 'UTF-8');
SimpleMessage.Body.Text := TSESV2Content.Create('Message content...', 'UTF-8');
SimpleMessage.AddAttachment(
TSESV2Attachment.Create(
'MyFile.txt',
'text/plain',
TEncoding.UTF8.GetBytes('Hello!')
)
);
// Create a request to send the email.
Request := TSESV2SendEmailRequest.Create;
Request.Destination := 'recipient@example.com';
Request.FromEmailAddress := 'sender@example.com';
Request.Content.Simple := SimpleMessage;
try
// Send the email.
Response := Client.SendEmail(Request);
if Response.IsSuccessful then
Writeln('Message sent!');
except
on E: ESESV2Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.