Sample code for 30+ languages & platforms
AutoIt

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 AutoIt Downloads

AutoIt
Local $bSuccess = False

;  Assumes Chilkat is unlocked. See Global Unlock Sample.

$bSuccess = False

$oMail = ObjCreate("Chilkat.MailMan")
;  Use the SMTP endpoint and SMTP credentials issued for the same AWS Region.
$oMail.SmtpHost = "email-smtp.us-west-2.amazonaws.com"
$oMail.SmtpPort = 465
$oMail.SmtpSsl = True
$oMail.RequireSslCertVerify = True
$oMail.SmtpUsername = "SES_SMTP_USERNAME"
$oMail.SmtpPassword = "SES_SMTP_PASSWORD"

$oEmail = ObjCreate("Chilkat.Email")
$oEmail.From = "sender+reports@example.com"
$oEmail.Subject = "SES SMTP connection test"
$oEmail.Body = "This message was submitted over implicit TLS on port 465."
$bSuccess = $oEmail.AddTo("SES mailbox simulator","success@simulator.amazonses.com")
If ($bSuccess <> True) Then
    ConsoleWrite($oEmail.LastErrorText & @CRLF)
    Exit
EndIf

$bSuccess = $oMail.SendEmail($oEmail)
If ($bSuccess <> True) Then
    ConsoleWrite($oMail.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("SES accepted the message over SMTP." & @CRLF)
$bSuccess = $oMail.CloseSmtpConnection()
If ($bSuccess <> True) Then
    ;  The server already accepted the message. Retrying here could send a duplicate.
    ConsoleWrite("The SMTP connection did not close cleanly." & @CRLF)
EndIf