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

Status
Not open for further replies.

MotoMusher

Active Member
Licensed User
Longtime User
Fantastic Erel. You saved my hide. I have tested this with Gmail and Hotmail (live.com) over starttls and it works great. No issues.

I do have a question. It does not seem to matter if I set enablessl to true or false when using starttls (just testing). Does that mean providers support both simultaneously, or are you trapping the SSL if StartTLS is enabled?

Doesn't matter I guess. Just curious.

Thanks again. This is huge.
 

tango

Member
Licensed User
Longtime User
please help.

FTP library used and during initialize FTP it gives unexpectedly : app has stopped

LogCat connected to: emulator-5556
** Activity (main) Create, isFirst = true **


** Activity (main) Resume **


main_upload_click (java line: 292)


java.lang.NoClassDefFoundError: anywheresoftware.b4a.net.FTPWrapper


at b4a.example.main._upload_click(main.java:292)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:155)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:151)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:59)
at android.view.View.performClick(View.java:4202)
at android.view.View$PerformClick.run(View.java:17340)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)


at dalvik.system.NativeStart.main(Native Method)
 

MotoMusher

Active Member
Licensed User
Longtime User
I use this in my apps to send pictures over SMTP. A lot of users have failures, most common symptom is with duplicate emails being sent. I have modified the code to be more stringent to avoid the dups as their submissions show on a website, but the errors continue to pile up. This happened in the old version, and also happens in the new version. Sometimes the errors vary, but the vast majority are as follows.

07/22/201320:38:40EmailFail-libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
07/22/201320:40:11EmailFail-libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)
07/22/201320:40:12EmailFail-libcore.io.ErrnoException: recvfrom failed: ECONNRESET (Connection reset by peer)

In researching, I ran across this article. I am wondering if it is applicable to the library? Not sure how I can implement a solution in my project to test. Any ideas?

http://stackoverflow.com/questions/...exception-connection-reset-by-peer-in-android

"This behavior can be disabled by setting the http.keepAlive system property to false before issuing any HTTP requests. The http.maxConnections property may be used to control how many idle connections to each server will be held."

Is this implemented, or is there any way for me to access it from the library?
 

MotoMusher

Active Member
Licensed User
Longtime User
One thing I have noticed is that I almost never get a failure over a wifi connection, which is what I use 99% of the time. Failure rate goes up based off of connection speed. I did some "in the field" testing on saturday and and had 6 out of 10 fail. 3 of the 6 had sent successfully, but had an error in the SMTP routine, and the other 3 failed to send completely. That was on a primarily 2G/Edge connection. Users on 4G connections seem to run about 20% failure rate. Attached is a sample image that generated one of the 3 err lines I posted above. Those particular pics were only 25kb in size. There is 1 line of text in the email, and a subject line of approx 20 chars.
 

Attachments

  • 1374547208000.jpg
    25.3 KB · Views: 180

MotoMusher

Active Member
Licensed User
Longtime User
i am using gmail to send personally,as are some other users, but not all .

i am having problems pasting into this box from my phone error log is 5 posts up . recvfrom failed econnreset
 

MotoMusher

Active Member
Licensed User
Longtime User
Are you using Gmail?

Seems like you will need to implement a "retry" mechanism. Try to send the failed mails a few minutes later.

Yes. I am using gmail. I was resending previously, but 50% of the messages actually send, then receive the error anyway, so resending causes duplicates.

I already have another screen where the the users see their failed messages and can resend or delete, but most users are not comfortable with an app that fails 20%-50% of the time in sending an email.

Are there alternate SMTP options people have used with B4A? That may at least show a difference in failure rates perhaps?
 

Stuart McLachlan

Member
Licensed User
Longtime User
Just tried this SMTP library for the first time. There doesn't seem to be any way to set a Date Header when sending email? Emails are coming in from the application without one. Am I missing something?

(Date is a required Header for Internet Mail Format specified in RFC5322 Para 3.6 "
The only required header fields are the origination date field and
the originator address field(s).
)
 

Stuart McLachlan

Member
Licensed User
Longtime User
Do you mean that you haven't encountered a missing date, or that you are not concerned that the email goes without one?
A missing or malformed Date Header is one of the tests that many spam filters use since the RFC standard requires one in a specific format. It's absence may well result in a message being rejected as spam.

Thanks , NetExtra allowed me the insert an appropriately formatted date.

But if you are intending to update the Net library at any time in the future, can I request that it automtically inserts an appropriately formatted Date Header at the time of sending in accordance with the standard RFC 5322?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…