Hi
My app has been sending scheduled emails, in the background, for many months. Recently, on one day last week, all emails stopped.
So I loaded a test app which sends a single email, using the same connection info and initiated on a button click (code below).
I have updated the NET library to 1.62 and spent hours trying to find the reason for failure:
- No emails, although using same (original) code.
- Tested repeatedly on two android phones.
- App reports emails having gone (SMTP_MessageSent(Success)=True), no errors
- There appears to be data indicating arrows on network connection icon during send.
- I have rebooted the phones to reset any potential anomalies.
- Played with the StartTLS and UseSSL settings to check if it's incorrect.
No go.
However, I can send an email from a PC using the same email accounts (server, user, password, starttls info.) and it works.
The test code:
All ideas welcome!!
Thanks.
My app has been sending scheduled emails, in the background, for many months. Recently, on one day last week, all emails stopped.
So I loaded a test app which sends a single email, using the same connection info and initiated on a button click (code below).
I have updated the NET library to 1.62 and spent hours trying to find the reason for failure:
- No emails, although using same (original) code.
- Tested repeatedly on two android phones.
- App reports emails having gone (SMTP_MessageSent(Success)=True), no errors
- There appears to be data indicating arrows on network connection icon during send.
- I have rebooted the phones to reset any potential anomalies.
- Played with the StartTLS and UseSSL settings to check if it's incorrect.
No go.
However, I can send an email from a PC using the same email accounts (server, user, password, starttls info.) and it works.
The test code:
B4X:
Sub Process_Globals
Dim SMTP1 As SMTP
Dim tmrWait As Timer
End Sub
Sub Globals
Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
SMTP1.Initialize("xxx", 587, "xxxxx", "xxx", "SMTP")
SMTP1.StartTLSMode=True
SMTP1.UseSSL=False
DoEvents
tmrWait.Initialize("tmrWait",10000)
tmrWait.Enabled=True
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Email
Try
SMTP1.To.Add("xxxxxx")
SMTP1.Subject ="Trial email from android"
SMTP1.Body = "Have you got it?"
SMTP1.Send
DoEvents
Log("Sent email")
ToastMessageShow("Sent test email",False)
Catch
Log("ERROR: " & LastException.Message)
End Try
End Sub
Sub tmrWait_Tick
tmrWait.Enabled=False
ExitApplication
End Sub
Sub SMTP_MessageSent(Success As Boolean)
Log("SMTP send: " & Success )
If Success Then
ToastMessageShow("Success!",True)
Else
ToastMessageShow("Failed to send!",True)
Log(LastException.Message)
End If
End Sub
Sub Button1_Click
Email
End Sub
All ideas welcome!!
Thanks.