B4J Question Error trying to send email

Cristian Rufino

Member
Licensed User
Hello, I try to send a test email and after several seconds the operation ends with an error. Any idea that it could be wrong with my code? Thanks in advance

B4X:
'Non-UI application (console / server application)
#Region Project Attributes 
    #CommandLineArgs:
    #MergeLibraries: True 
#End Region

Sub Process_Globals
    Dim SmtpServer As SMTP
End Sub

Sub AppStart (Args() As String)
    CallSubDelayed(Me, "EnviarCorreo")
    StartMessageLoop   
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Private Sub EnviarCorreo
    SmtpServer.Initialize("smtp.fibertel.com.ar", 25, "crisxxxxx@fibertel.com.ar","xxxxxx","SMTP")
    SmtpServer.To.Add("crisxxxxx@gmail.com")
    SmtpServer.Subject = "Prueba de Envio"
    SmtpServer.Body = "Prueba Prueba Prueba Prueba"
    SmtpServer.Send
End Sub

Sub SMTP_MessageSent(Success As Boolean)
    If Success Then
        Log("*** OK ***")
    Else
        Log("*** Error ***")
    End If
End Sub

 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…