Delphi DLL
Delphi DLL
Amazon SES SMTP: Send email over implicit TLS on port 465
See more Amazon SES Examples
Connect to the regional SES SMTP endpoint with TLS from the start of the connection. Load the SMTP username and password from protected application configuration. SES SMTP passwords are Region-specific and differ from AWS secret access keys used to sign API requests. Replace the From address with a verified sender. The example delivers to the SES mailbox simulator.
TLS connections to SES SMTP · Obtain SMTP credentials
Chilkat Delphi DLL Downloads
var
success: Boolean;
mail: HCkMailMan;
email: HCkEmail;
begin
success := False;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
success := False;
mail := CkMailMan_Create();
// Use the SMTP endpoint and SMTP credentials issued for the same AWS Region.
CkMailMan_putSmtpHost(mail,'email-smtp.us-west-2.amazonaws.com');
CkMailMan_putSmtpPort(mail,465);
CkMailMan_putSmtpSsl(mail,True);
CkMailMan_putRequireSslCertVerify(mail,True);
CkMailMan_putSmtpUsername(mail,'SES_SMTP_USERNAME');
CkMailMan_putSmtpPassword(mail,'SES_SMTP_PASSWORD');
email := CkEmail_Create();
CkEmail_putFrom(email,'sender+reports@example.com');
CkEmail_putSubject(email,'SES SMTP connection test');
CkEmail_putBody(email,'This message was submitted over implicit TLS on port 465.');
success := CkEmail_AddTo(email,'SES mailbox simulator','success@simulator.amazonses.com');
if (success <> True) then
begin
Memo1.Lines.Add(CkEmail__lastErrorText(email));
Exit;
end;
success := CkMailMan_SendEmail(mail,email);
if (success <> True) then
begin
Memo1.Lines.Add(CkMailMan__lastErrorText(mail));
Exit;
end;
Memo1.Lines.Add('SES accepted the message over SMTP.');
success := CkMailMan_CloseSmtpConnection(mail);
if (success <> True) then
begin
// The server already accepted the message. Retrying here could send a duplicate.
Memo1.Lines.Add('The SMTP connection did not close cleanly.');
end;
CkMailMan_Dispose(mail);
CkEmail_Dispose(email);