Android Question What's wrong with this code: SMTP

Discussion in 'Android Questions' started by Beja, Mar 4, 2015.

  1. Beja

    Beja Expert Licensed User

    Hi,
    Experimenting with the NET library, I found this code uploaded to this forum by a friend.. but trying to run it, it
    gave me "not ok" without explanation :)
    Any hint appreciated
    Code:
    Sub Process_Globals
        
    Dim Sm As SMTP
    End Sub

    Sub Globals
        
    Dim P2 As Phone
        
    Private Button1 As Button
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
        
    Activity.LoadLayout("1")
        
    If FirstTime Then
            Sm.Initialize( 
    "smtp.gmail.com"587"yt65red""llkmnh0l()""SM")
              Sm.StartTLSMode = 
    True
            Sm.StartTLSMode = 
    True
        
    End If
    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub
    Sub SM_MessageSent(Success As Boolean)
          
    If(Success) Then
            
    Msgbox("Ok","")
        
    Else
            
    Msgbox("not ok","")
        
    End If
    End Sub
     
    Sub Button1_Click
            Sm.To.Add(
    "7yt5655@gmail.com")
        Sm.Subject = 
    "This is a test"
        Sm.Body = 
    "This is a test of the messagwe body" 
        Sm.Send
    End Sub
     
  2. migrec

    migrec Member Licensed User

    It is something with your email address or password, i copied your code and changed to my gmail address and it gave me an "ok"
    nothing wrong in your code ;)
     
    Beja likes this.
  3. Beja

    Beja Expert Licensed User

    Thanks migrec,
    The code is not mine, and not working in my device, I don't know why.. I am pretty sure my id and pwd are both correct.
     
  4. giga

    giga Well-Known Member Licensed User

    Does it work on gmail.com directly? Does it work if you configured those settings in Outlook or Windows live mail?
     
  5. Beja

    Beja Expert Licensed User

    Hi giga,
    I am using gmail for both emails.. send and receive.
     
  6. masterleous

    masterleous Member Licensed User

    Check your Gmail account settings, Your email address must be capable to allow unsecured applications to send emails. It will work
     
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