Visual FoxPro
Visual FoxPro
Send email using SMTP STARTTLS.
Send email using SMTP STARTTLS. With STARTTLS, the SMTP client connects to the SMTP server on port 25 (non-SSL) and then issues a STARTTLS command to convert the connection to a secure TLS channel.Chilkat Visual FoxPro Downloads
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.mymailserver.com"
loMailman.SmtpUsername = "myLogin"
loMailman.SmtpPassword = "myPassword"
loMailman.StartTLS = 1
* 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 <support@chilkatsoft.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