NET Library - SMTP - NumberFormatException

laguilar

Member
Licensed User
Longtime User
hey guys maybe you can help me out with this. im trying to send en email upon registration of our application. here is my code below. it successfully goes through the send function and it logs with a failure due to a NumberFormatException. any ideas? the domain is temporarily for private use until we go live so the real domain has been replaced with MYDOMAIN.com for sake of this post.

The mail server im using is MailEnable Mail Server running on a dedicated windows web host. the address [email protected] exists and the password is correct. I've tried 2 variations of the username one with the @MYDOMAIN.com and one without with the same result. port is correct. it uses ssl. I've verified the connectivity with another mail client.

B4X:
report.Initialize("mail.MYDOMAIN.com", 587, "[email protected]", "password", "report")
report.UseSSL = True
report.To.Add("[email protected]")
report.Sender = "[email protected]"
report.Subject = "Android Registration"
report.Body = "--Android Registration--" & CRLF
report.Body = report.Body & "--Company Information--" & CRLF
For i = 0 To comprow.Size - 1
   report.Body = report.Body & comprow.GetKeyAt(i) & ":" & comprow.GetValueAt(i)
Next
report.Send

B4X:
Sub report_MessageSent(Success As Boolean)
    Log(Success)
    If Success Then
        ToastMessageShow("Message sent successfully", True)
    Else
        ToastMessageShow("Error sending message", True)
        Log(LastException.Message)
    End If
End Sub

B4X:
** Activity (main) Create, isFirst = True **
** Activity (main) Resume **
false
java.lang.NumberFormatException: Invalid double: "null"
 

laguilar

Member
Licensed User
Longtime User
detailed logcat

here is the details below. it says You must specify the recipients of a message before you can send it. clearly I set the recipient.

B4X:
java.lang.RuntimeException: Empty writer returned: 503 Bad sequence of commands. You must specify the recipients of a message before you can send it
at anywheresoftware.b4a.net.SMTPWrapper$1.run(SMTPWrapper.java:248)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
 

melamoud

Active Member
Licensed User
Longtime User
something to try

you should try sending using gmail , just to see if the problem is competability with your mail server or not (gmail should work)

I had similar case / error but I was using by mistake an SMTP object twice, (I called send twice, the problem is that the send method clean the SMTP object and thats why I got the error that I do not have recepiants configured.

are you sure you are not doing that (calling send somewhere else in the code)
if you do that maybe the error for this line is something else like no rout to host or something like that and the error for the other send is what you see right now (SMTP object is wiped clean) - I know its not likely but worth noting....
 

laguilar

Member
Licensed User
Longtime User
gmail works

thats confirmed. gmail worked. I created a test account at gmail and it worked.
 

melamoud

Active Member
Licensed User
Longtime User
SO I guess the problem is competability of thje net lib implmentation of SMTP with the mail server you are using right ?
do you own that mail server ? can you turn off SSL to check if the problem is the SSL competability ?
 

laguilar

Member
Licensed User
Longtime User
SO I guess the problem is competability of thje net lib implmentation of SMTP with the mail server you are using right ?
do you own that mail server ? can you turn off SSL to check if the problem is the SSL competability ?

same problem with ssl. and I cant quite say we own the mail server but we do lease a dedicated Windows VPS running Mail Enable Mail Server.
 
Top