Android Question Error sending e-mail via SMTP with POP

SergeNova

Member
Hello everyone, I am trying to send an e-mail via SMTP with POP but the application stops just as I call this service.
B4X:
Sub Process_Globals
    Dim emailing As clsemail
    Dim YOUR_GMAIL_PASSWORD As String = "xxxxxxxx"
    Dim list1sec As List
    Dim Subject As String = "Trying"
    Dim Body As String = "B4A Send Email"
End Sub

Sub Service_Start (StartingIntent As Intent)
    Dim a As String = "xxxx@gmail.com"
    Dim b As String = "yyyy@gmail.com"
    emailing.Initialize(Me, "smtp.gmail.com", "pop.gmail.com", a, YOUR_GMAIL_PASSWORD, b, b)
    If File.Exists(File.DirInternal, "1.txt") = True Then
        list1sec = File.ReadList(File.DirInternal, "1.txt")
    End If
    Send
End Sub

Sub Send
    Dim res As ResumableSub = emailing.SendEmail(Subject, Body, list1sec)
    Wait For (res) Complete (Success As String)
    If Success Then
        ToastMessageShow("Send", True)
    Else
        ToastMessageShow("Error", True)
    End If
End Sub
I have checked the code but cannot find what is causing the application to stop. Can you help me. Thank you
 

Attachments

  • SendEmailB4A.zip
    11.9 KB · Views: 231

SergeNova

Member
I get 2 error messages including: ( See the images below )
 

Attachments

  • Error1.JPG
    Error1.JPG
    89.6 KB · Views: 231
  • error2.JPG
    error2.JPG
    75.2 KB · Views: 239
Upvote 0

SergeNova

Member
Yes yes I had noticed this then I had initialized but the problem still continued because I tried to send a list when "Attachment is defined as Map", I just had to replace this:
B4X:
Sub Send
    Dim res As ResumableSub = emailing.SendEmail(Subject, Body, list1sec)
    Wait For (res) Complete (Success As String)
    If Success Then
        ToastMessageShow("Send", True)
    Else
        ToastMessageShow("Error", True)
    End If
End Sub



by this code:

B4X:
Sub Send
    Dim Attachment as Map
    Dim res As ResumableSub = emailing.SendEmail(Subject, Body, Attachment)
    Wait For (res) Complete (Success As String)
    If Success Then
        ToastMessageShow("Send", True)
    Else
        ToastMessageShow("Error", True)
    End If
End Sub
 
Upvote 0
Top