Sample code for 30+ languages & platforms
Visual FoxPro

Send email using smtp.gmail.com with SSL (port 465).

Send email using smtp.gmail.com with SSL (port 465).

Chilkat Visual FoxPro Downloads

Visual FoxPro
LOCAL lnSuccess
LOCAL loMailman
LOCAL loEmail

lnSuccess = 0

* This example requires the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.

* The mailman object is used for sending and receiving email.
loMailman = CreateObject('Chilkat.MailMan')

* Set the SMTP server.
loMailman.SmtpHost = "smtp.gmail.com"

loMailman.SmtpUsername = "mySmtpLogin"
loMailman.SmtpPassword = "myPassword"

loMailman.SmtpSsl = 1
loMailman.SmtpPort = 465

* Create a new email object
loEmail = CreateObject('Chilkat.Email')

loEmail.Subject = "This is a test"
loEmail.Body = "This is a test"
loEmail.From = "Chilkat Support <chilkat.support@gmail.com>"
lnSuccess = loEmail.AddTo("Chilkat Admin","admin@chilkatsoft.com")

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

lnSuccess = loMailman.CloseSmtpConnection()
IF (lnSuccess <> 1) THEN
    ? "Connection to SMTP server not closed cleanly."
ENDIF

? "Mail Sent!"

RELEASE loMailman
RELEASE loEmail