Android Question The email is not sent (with created file inside) but no error message

Luis Felipe

Licensed User
Longtime User
Hi every body,

Improving my first app, I'm trying to send by email (via the NET library) the now created text file from the sqlite db.
The file is created (I can see it and read directly into the tablet) but when I try to sent it using the SMTP protocol, it doesn't send it.
Using a Try/Catch I got a success message but the fact is that the email is not sent (and obviously not received).
I tried with several emails but none seems working.
What am I missing?
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:

    If FirstTime Then
        'SMTP.Initialize("", 587, "[email protected]", "xxxx", "SMTP")
        SMTP.Initialize("", 587, "[email protected]", "xxxx", "SMTP")
        SMTP.StartTLSMode = True
    End If

    'SMTP.To.Add("[email protected]")
    SMTP.To.Add("[email protected]")
    SMTP.Subject = "Prueba de envio de un archivo de texto desde el tablet"
    SMTP.Body = "Prueba de envio del archivo de texto desde el tablet."
    SMTP.AddAttachment(File.DirRootExternal & "/Encuestas", exportfile)
    Msgbox("Archivo de texto enviado", "Exito")
    Log("Text file not sent")
    End Try

End Sub


    24.6 KB · Views: 156
Last edited:

Luis Felipe

Licensed User
Longtime User
It seems to work without adding the text file.
The text file exists, so what's wrong ? Or may'be I can't reuse the name of the generated file with the variable
Upvote 0

Luis Felipe

Licensed User
Longtime User
Are you handling the MessageSent event? Is Success true there?

What is the output of: Log(File.Exists(File.DirRootExternal & "/Encuestas", exportfile)) ?

Hi Erel,
Sorry for the late answer (I was sick yesterday :-(). I did not manage the MessageEvent but now I do. It gave me "false" but I found the reason.
Thank you very much.
Extra answer: I can see the generated text file directly in that folder within the tablet but not directly from the Windows desktop PC : is there a way to change that ?
Same question for the sqlite db I create (directly via a "Create table" script within the Activity). Is there a way to see it (I tried Android SQLite Viewer but it can't see it)
? because managing a sqlite db via an Activity is not so easy. At least a way to duplicate it elsewhere?
For example I try to create the text file in the sd card of the tablet but I did not manage it...
Thanx in advance.
Last edited:
Upvote 0


B4X founder
Staff member
Licensed User
Longtime User
Upvote 0