I'm experimenting with NetTalk to create and send emails. From the example code I have built a short test routine and I have successfully called the routine and sent email from an embed of a button on a window.
But copying the same code into a Process procedure in the last INIT embed does not work. But No compile errors.
It sure looks like the extensions are set up the same way in both procedures. My code is below. Am I missing something?
ThisEmailSend.Server = 'smtpout.secureserver.net'
ThisEmailSend.Port = 80 ! 25
ThisEmailSend.ToList = 'kraigwhiting@gmail.com'
ThisEmailSend.ccList = ''
ThisEmailSend.bccList = ''
ThisEmailSend.From = 'kraig@commandelectronics.com'
ThisEmailSend.Subject = 'test email' !MySubject
ThisEmailSend.Helo = 'commandelectronics.com'
ThisEmailSend.AttachmentList = ''
ThisEmailSend.SSL = 0
ThisEmailSend.SecureEmailStartTLS = 0
if ThisEmailSend.SSL or ThisEmailSend.SecureEmailStartTLS
ThisEmailSend.SSLCertificateOptions.CertificateFile = ''
ThisEmailSend.SSLCertificateOptions.PrivateKeyFile = ''
ThisEmailSend.SSLCertificateOptions.DontVerifyRemoteCertificateWithCARoot = 0
ThisEmailSend.SSLCertificateOptions.DontVerifyRemoteCertificateCommonName = 0
ThisEmailSend.SSLCertificateOptions.CARootFile = '.\caroot.pem'
end
if ThisEmailSend.SecureEmailStartTLS
ThisEmailSend.SSLCertificateOptions.DontVerifyRemoteCertificateCommonName = 1
! Fudge this for now, as the certificate is not known
! when NetSimple does the CommonName check
end
ThisEmailSend.SetRequiredMessageSize (0,len(clip('this looks very promising')),len(clip('This looks <b>very</b> promising.')))
!You must call this function
!before populating self.MesageText
Thisemailsend.AuthUser = 'kraig@commandelectronics.com'
thisemailsend.AuthPassword = 'NotMyRealPassword'
if ThisEmailSend.Error = 0 ! Check for error
if len(clip('this looks very promising')) > 0
ThisEmailSend.MessageText = clip ('this looks very promising')
end
if len(clip('This looks <b>very</b> promising.')) > 0
ThisEmailSend.MessageHTML = clip ('This looks <b>very</b> promising.')
end
setcursor (CURSOR:WAIT)
display()
ThisEmailSend.SendMail(NET:EMailMadeFromPartsMode)
! Put email in queue and start sending it
setcursor
display()
ELSE
message('ThisEmailSend.Error > 0',Thisemailsend.Error)
end