Android Question Send email with SMTP

Discussion in 'Android Questions' started by Marco Maria Vilucchi, May 21, 2019.

  1. Marco Maria Vilucchi

    Marco Maria Vilucchi Active Member Licensed User

    Hi all,
    I'm trying to send an email using SMTP.
    It should be a simple thing, but doesn't work.
    I have only this log message: sending message to waiting queue (smtp_messagesent)
    where am I wrong?
    this is my code:

    Code:
    Sub Process_Globals
            
    Dim SMTP As SMTP
    End Sub

    Sub Globals
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    If FirstTime Then
            
    SMTP.Initialize("smtp.gmail.com"587"user","password","SMTP")
            
    SMTP.UseSSL = False   '   Gmail requires SSL.
        End If
        EnviaEMail
    End Sub

    Sub EnviaEMail
    '    SMTP.Initialize("smtp.gmail.com", 587, "user","password","SMTP")
        SMTP.UseSSL = True
        
    SMTP.AuthMethod=SMTP.AUTH_LOGIN
        
    SMTP.To.Add("receiver@gmail.com")
        
    SMTP.Subject = "Ciao"
        
    SMTP.Body = "Ciao"
        
    SMTP.AddAttachment(File.DirDefaultExternal,"file.txt")
    '    SMTP.AddAttachment(File.DirInternal & "/extfiles/","filename")
        SMTP.Send
    End Sub

    Sub SMTP_MessageSent(Success As Boolean)
        
    Dim StatusSend1 As String
        
    If Success=True Then StatusSend1="SI inviato"
        
    If Success=False Then StatusSend1="NO inviato"
        
    Log(StatusSend1)
    End Sub
    Can someone help me?
    Thanks
    Marcom
     
  2. Marco Maria Vilucchi

    Marco Maria Vilucchi Active Member Licensed User

    Seems solved
    I needed this statement:
    SMTP.StartTLSMode = True
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice