DataFlex
DataFlex
Send email using smtp.gmail.com with SSL (port 465).
Send email using smtp.gmail.com with SSL (port 465).Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoMailman
Variant vEmail
Handle hoEmail
String sTemp1
Move False To iSuccess
// 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.
Get Create (RefClass(cComChilkatMailMan)) To hoMailman
If (Not(IsComObjectCreated(hoMailman))) Begin
Send CreateComObject of hoMailman
End
// Set the SMTP server.
Set ComSmtpHost Of hoMailman To "smtp.gmail.com"
Set ComSmtpUsername Of hoMailman To "mySmtpLogin"
Set ComSmtpPassword Of hoMailman To "myPassword"
Set ComSmtpSsl Of hoMailman To True
Set ComSmtpPort Of hoMailman To 465
// Create a new email object
Get Create (RefClass(cComChilkatEmail)) To hoEmail
If (Not(IsComObjectCreated(hoEmail))) Begin
Send CreateComObject of hoEmail
End
Set ComSubject Of hoEmail To "This is a test"
Set ComBody Of hoEmail To "This is a test"
Set ComFrom Of hoEmail To "Chilkat Support <chilkat.support@gmail.com>"
Get ComAddTo Of hoEmail "Chilkat Admin" "admin@chilkatsoft.com" To iSuccess
Get pvComObject of hoEmail to vEmail
Get ComSendEmail Of hoMailman vEmail To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoMailman To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComCloseSmtpConnection Of hoMailman To iSuccess
If (iSuccess <> True) Begin
Showln "Connection to SMTP server not closed cleanly."
End
Showln "Mail Sent!"
End_Procedure