Hi,
I'm creating EMails in a service. Sometimes after SMTP.Send the SMTP_MessageSent sub is not triggered. Code like that:
B4X:
' Service
Sub Process_Globals
dim SMTP1 as SMTP
End Sub
Sub sendEmail
SMTP1.Initialize(..., "SMTP1")
[... Setup SMTP1 ...]
SMTP1.Send
ToastMessageShow("sending message...")
End Sub
Sub SMTP1_MessageSent(Success As Boolean)
If Success Then
ToastMessageShow("message sent.")
Else
ToastMessageShow(LastException.Message)
End If
End Sub
Most times it succeeds normally. In some cases neither "message sent" nor an errror message is shown.
Are there known issues? Has anybody an idea why the SMTP1_MessageSent is never called?
If you want to have a backup in case the messagesent event doesn't occur, you could add a 1 minute timer and call it "tmrSMTPTimeout" and start the timer when you do the .Send.
Then if the _MessageSent event properly triggers, do a tmrSMTPTimeout.enabled = false to prevent the timer from falsely triggering.
And if the tmr_Tick Event triggers, then handle the timeout condition.
@Erel: ok, that's what I thought. But I have logs in the original app. @JohnC: well, yes, that's an idea... but I still don't know if the mail was sent or not.
Is the source code available from the Net Library? I really would like to know in which cases it is possible that the MessageSent-Sub isn't called...
Wireshark is your friend.
The problem is, that Android tries to contact the SMTP server via IPv6... the SMTP server listens on IPv6, but the firewall filters it...
I will create a timer so the customer gets the info. And somebody has to fix the firewall.