Hi there
Has anyone tried to use a ResumableSub inside ABMaterial?
I have just converted my SendEmail subroutine to use ResumableSub to no avail using the jnet 1.77 library.
For some reason my app never goes beyong the Wait For statement.
This is based on this article here which was showing a way to send emails using smtp inside an ABMaterial app. If I remove the wait for and just use .send, it runs, any ideas please?
NB: The same code in a normal b4j app works perfectly.
Thanks
Has anyone tried to use a ResumableSub inside ABMaterial?
I have just converted my SendEmail subroutine to use ResumableSub to no avail using the jnet 1.77 library.
For some reason my app never goes beyong the Wait For statement.
B4X:
Sub SendEmail(toEmail As String, subject As String, msg As String) As ResumableSub
'Try
'read the email settings first
Dim es As Map = GetEmailSettings
Dim sserver As String = es.GetDefault("server","")
Dim sport As String = es.GetDefault("port","25")
Dim susername As String = es.GetDefault("username","")
Dim spassword As String = es.GetDefault("password","")
Dim sStartTLSMode As String = es.GetDefault("starttlsmode","0")
Dim sUseSSL As String = es.GetDefault("usessl","0")
'start sending the email
esmtp.Initialize(sserver, sport, susername, spassword, "smtp")
esmtp.To.Add(toEmail)
esmtp.Body = msg
esmtp.Subject = subject
If sStartTLSMode = "1" Then
esmtp.StartTLSMode = True
Else
esmtp.StartTLSMode = False
End If
If sUseSSL = "1" Then
esmtp.UseSSL = True
Else
esmtp.UseSSL = False
End If
Wait For (esmtp.Send) smtp_MessageSent(Success As Boolean)
Return Success
'Catch
' Return False
'End Try
End Sub
This is based on this article here which was showing a way to send emails using smtp inside an ABMaterial app. If I remove the wait for and just use .send, it runs, any ideas please?
NB: The same code in a normal b4j app works perfectly.
Thanks