B4J Question Error trying to send email

Discussion in 'B4J Questions' started by Cristian Rufino, Apr 20, 2019.

  1. Cristian Rufino

    Cristian Rufino New 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

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

    Sub Process_Globals
    Dim SmtpServer As SMTP
    End Sub

    Sub AppStart (Args() As String)
    End Sub

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

    Private Sub EnviarCorreo
        SmtpServer.Subject = 
    "Prueba de Envio"
        SmtpServer.Body = 
    "Prueba Prueba Prueba Prueba"
    End Sub

    Sub SMTP_MessageSent(Success As Boolean)
    If Success Then
    Log("*** OK ***")
    Log("*** Error ***")
    End If
    End Sub
  2. Erel

    Erel Administrator Staff Member Licensed User

    No reason to use CallSubDelayed here.

    Probably an authentication issue.
    Does the mail server allow plain text connections? If not then set UseSSL or StartTlsMode. There are also three AuthMethods that you should try.
    Cristian Rufino likes this.
  3. Cristian Rufino

    Cristian Rufino New Member Licensed User

    SmtpServer.AuthMethod = SmtpServer.AUTH_LOGIN
    Thanks Erel
  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