B4A Library New Net library - Android FTP, SMTP and POP3

Discussion in 'Additional libraries, classes and official updates' started by Erel, Aug 17, 2011.

Thread Status:
Not open for further replies.
  1. AscySoft

    AscySoft Active Member Licensed User

    Hi, thanks for confirming that I am so negligent. Well, I'm glad this happened.
     
  2. MotoMusher

    MotoMusher Active Member Licensed User

    This library is great. I have a question on SMTP content-type.

    I believe attachments are being sent as application/octet-stream. It works fine, but one of the services that users are using wants image/jpeg and it is discarding octet-stream messages.

    Any ideas how to get around it? SMTP message in my case is always just a post of an image taken with the camera I wrote.
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    It is currently not possible to change the content type of attachments.
     
  4. rboeck

    rboeck Well-Known Member Licensed User

    GermanUmlaute with SMTP library

    i found out, that 'umlaute' in smtp1.sender are not handled correct, but umlaute in body and subject works without any problems.

    The sender name should be: Böck, but the receiver gets: Böck

    Any tipps to convert this string?

    Greetings
    Reinhard
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Are you setting it do a non-email address value?
     
  6. rboeck

    rboeck Well-Known Member Licensed User

    Yes; i want to send with my real name;here is the code:

    Code:
    SMTP1.Sender = Main.Setup.Get("Name")  'real name with umlaute..
    SMTP1.To.Add(EditText5.Text)                   ' email adress
    Greetings and thanks for your help!
    Reinhard
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Please try the attached updated library.
     

    Attached Files:

    • Net.zip
      File size:
      178.5 KB
      Views:
      103
  8. rboeck

    rboeck Well-Known Member Licensed User

    Hi Erel,

    i never used such a futuristic library, which date is in the future! ;)

    Back to my problem: In Outlook can see now the 'Umlaute', but it is not the usual style:

    This is the line on top of the message:
    Reinhard Böck <=?UTF-8?Q?Reinhard_B=C3=B6ck?=>

    A message sent to myself look like:
    Reinhard Böck <reinhard.boeck@gmail.com>

    On the tablet i see the incoming mail and in the short preview i see only ""< for a short time. Inside gmail on handy and tablet now i see everything correct.
    Maybe ic could convert the sender field and replace the umlaute with something ...

    Many thanks for your work!
    Reinhard
     
  9. MotoMusher

    MotoMusher Active Member Licensed User

    Has anyone else gotten this to work with Hotmail or me.com over SMTP?

    Gmail users and others are fine, myself included. My hotmail users and me.com are having problems.

    I signed up for a hotmail.com account to test and get the following error.

    SendTestEmail-javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x140f1a0: Failure in SSL library, usually a protocol error
    error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:683 0x40193cf5:0x00000000)


    Setup is xxx@hotmail.com
    smtp.live.com
    ssl enabled
    port 587

    I was not trapping the me.com (icloud.com) errors in the current release and don't have an account to check there.

    In a little research it appears that "starttls" may be different than SSL/TLS? I don't know enough to comment. Issue 20175 - android - Mail setup issues - Android - An Open Handset Alliance Project - Google Project Hosting


    Any help is appreciated.
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    Are you able to connect to this provider with the default mail app?
     
  11. MotoMusher

    MotoMusher Active Member Licensed User

    It does pass the validation step for incoming and outgoing mail in the android app with the letter and @ wax seal logo. It also sends and receives email. The app has choices for both SSL and TLS and it is picking TLS on the autosetup not SSL.

    Most cases where users have a failure in my app the provider specifies TLS.

    My app still fails with same setup.
     
    Last edited: Apr 30, 2013
  12. Erel

    Erel Administrator Staff Member Licensed User

  13. MotoMusher

    MotoMusher Active Member Licensed User

    That would be great. Thank you Erel.

    That last paragraph in the link makes sense. Seems odd that Microsoft and Apple both are still using 587.
     
    Last edited: Apr 30, 2013
  14. mc73

    mc73 Well-Known Member Licensed User

    Seems to me that TLS is not supported for now. Is there a chance this may change soon? Yahoo servers strictly use TLS since some time and I have to change my app accordingly.
     
  15. GMan

    GMan Well-Known Member Licensed User

    Hi Erel,
    i always got an error in the log when sending an email:
    Code:
    false
    java.net.UnknownHostException: 
    smtp.gmail.com
    all parameters are correct, the email soft(outlook) connects well and works fine.

    I will send a body with some contents of some EditText's like this:
    Code:
    SMTP.Body = Name.Text & CRLF & Surname.Text & CRLF
    Any suggestions for this ?
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the code (without the user name and password)?

    Are you testing it with a real device? Are you sure that the device is connected to the internet?
     
  17. MotoMusher

    MotoMusher Active Member Licensed User

    GMan Your problem may be with enable ssl, or the port. Port should be 465 with UseSSL true

    Here's my code that works fine with this library with the exception of providers requiring StartTLS (yahoo.com, me.com, outlook.com, live.com etc)


    Code:
    Dim SMTP As SMTP
    Dim MyFilePath As String
    Dim DirName As String = "Something"
    MyFilePath = 
    File.DirRootExternal & "/" & DirName & "/SomethingElse/"
    SMTP.Initialize(MyAuth.CamSMTPServer, MyAuth.CamPort, MyAuth.CamMyEmail, MyAuth.CamMyPass, "SMTP")
    SMTP.UseSSL = MyAuth.CamSSL 'True 'Gmail requires SSL.
    SMTP.To.Add("myemail@gmail.com")
    SMTP.To.Add(MyAuth.CamMyEmail)
    SMTP.Subject = "TestMessage"
    SMTP.HtmlBody = False
    SMTP.AddAttachment(File.DirAssets, Main.Graphic)   
    SMTP.Send
    Also, you may want to make use of .trim (surname.text.trim). Sooner or later it will bite you if you don't. This is especially true for when setting port numbers, and email addresses, and smtp servers and passwords...
     
    Last edited: Jul 8, 2013
  18. GMan

    GMan Well-Known Member Licensed User

    Thx Erel,

    just solved the "problem" :D
    was sitting outside with my notebook and it lost connection (i tested this time with the Virtual Device), so email couldn't work.

    So, everything is fine - but finest of all is your lib :sign0188:
     
  19. Erel

    Erel Administrator Staff Member Licensed User

    STARTTLS mode is now supported. See first post.
     
  20. sktanmoy

    sktanmoy Active Member Licensed User

    Starttls

    I failed to understand how to use STARTTLS after reading first post? smtp.StartTLSMode = ture will work? Or anything else?
     
    Last edited: Jul 9, 2013
Thread Status:
Not open for further replies.
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