Sample code for 30+ languages & platforms
Visual FoxPro

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 Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loMail
LOCAL loEmail

lnSuccess = 0

*  Assumes Chilkat is unlocked. See Global Unlock Sample.

lnSuccess = 0

loMail = CreateObject('Chilkat.MailMan')
*  Use the SMTP endpoint and SMTP credentials issued for the same AWS Region.
loMail.SmtpHost = "email-smtp.us-west-2.amazonaws.com"
loMail.SmtpPort = 465
loMail.SmtpSsl = 1
loMail.RequireSslCertVerify = 1
loMail.SmtpUsername = "SES_SMTP_USERNAME"
loMail.SmtpPassword = "SES_SMTP_PASSWORD"

loEmail = CreateObject('Chilkat.Email')
loEmail.From = "sender+reports@example.com"
loEmail.Subject = "SES SMTP connection test"
loEmail.Body = "This message was submitted over implicit TLS on port 465."
lnSuccess = loEmail.AddTo("SES mailbox simulator","success@simulator.amazonses.com")
IF (lnSuccess <> 1) THEN
    ? loEmail.LastErrorText
    RELEASE loMail
    RELEASE loEmail
    CANCEL
ENDIF

lnSuccess = loMail.SendEmail(loEmail)
IF (lnSuccess <> 1) THEN
    ? loMail.LastErrorText
    RELEASE loMail
    RELEASE loEmail
    CANCEL
ENDIF

? "SES accepted the message over SMTP."
lnSuccess = loMail.CloseSmtpConnection()
IF (lnSuccess <> 1) THEN
    *  The server already accepted the message. Retrying here could send a duplicate.
    ? "The SMTP connection did not close cleanly."
ENDIF

RELEASE loMail
RELEASE loEmail