Xbase++
Xbase++
Send email using smtp.gmail.com with SSL (port 465).
Send email using smtp.gmail.com with SSL (port 465).Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oMailman
LOCAL oEmail
nSuccess := 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.
oMailman := CreateObject("Chilkat.MailMan")
// Set the SMTP server.
oMailman:SmtpHost := "smtp.gmail.com"
oMailman:SmtpUsername := "mySmtpLogin"
oMailman:SmtpPassword := "myPassword"
oMailman:SmtpSsl := 1
oMailman:SmtpPort := 465
// Create a new email object
oEmail := CreateObject("Chilkat.Email")
oEmail:Subject := "This is a test"
oEmail:Body := "This is a test"
oEmail:From := "Chilkat Support <chilkat.support@gmail.com>"
nSuccess := oEmail:AddTo("Chilkat Admin", "admin@chilkatsoft.com")
nSuccess := oMailman:SendEmail(oEmail)
IF (nSuccess != 1)
? oMailman:LastErrorText
oMailman:destroy()
oEmail:destroy()
RETURN
ENDIF
nSuccess := oMailman:CloseSmtpConnection()
IF (nSuccess != 1)
? "Connection to SMTP server not closed cleanly."
ENDIF
? "Mail Sent!"
oMailman:destroy()
oEmail:destroy()