PowerBuilder example for sending email

Question:

Do you have an example program in PowerBuilder for sending email?

Answer:

Here is an example:

OLEObject mailman 
OLEObject eMail

mailman = Create OLEObject
eMail   = Create OLEObject

li_return = mailman.ConnectToNewObject("ChilkatMail2.ChilkatMailMan2.1")
If li_return <> 0 Then
   Destroy mailman 
   Return 98       
End if

li_return = eMail.ConnectToNewObject("ChilkatMail2.ChilkatEMail2.1")    
If li_return <> 0 Then
   Destroy eMail
   Return 97      
End if

mailman.UnlockComponent("unlock-code")

mailman.SmtpHost = "smtp.mail.com"
mailman.SmtpPort = 25

eMail.AddTo("Support", "support@chilkatsoft.com")
eMail.Subject = "This is the email subject"
eMail.Body = "This is the email body."
eMail.From = "joe.programmer@somewhere.com"

mailman.SendEmail(eMail)