Android Question Error 503 Bad sequence of commands in smtp send email

Edyab

Member
Licensed User
Longtime User
I'm trying to send email with net library and SMTP
but i get the following error :
java.lang.RuntimeException: Empty writer returned: 503 Bad sequence of commands

I use my own mailserver , it does not require ssl , I can send email with my c# code , ie. the mailserver works fine.
the b4a code is simple :

B4X:
SMTP.Initialize("MySMTPHost" , 587 , "MyAccount" , "MyPass" , "SMTP") 
    SMTP.Subject = "Test"   
    SMTP.To.Add("ToAddress")
    SMTP.Sender = "FromAddress"       
    SMTP.Body = "this is a Test "           
    SMTP.HtmlBody = False
    SMTP.AddAttachment(File.DirRootExternal & "/Files" , "somefile.dat")

and i can send email with gmail smtp server but usually I get the timeout error , so that I want to use my own mail server.
any idea ? is something wrong with net library?
I read a same issue in forum : SMTP 503 error in Net library , but it didnt help.
 

Edyab

Member
Licensed User
Longtime User
Are you sure that it doesn't require SSL or StartTLSMode? Try to set StartTLSMode to true.
No It doesnt require , I set it to true then this error occurred :
javax.net.ssl.SSLException: 503 TLS is not allowed
 
Upvote 0

Mark Hollingworth

Member
Licensed User
Longtime User
Bit of an old post but thought this might be helpful :)

I have just had a similar problem where I can send mail using gmail settings but when switching to my own mail server it doesn't send and gives the 503 error.
I have found that adding this line before sending has fixed it and I can now send successfully, hope this helps.

SMTP.AuthMethod = SMTP.AUTH_LOGIN
 
Upvote 0

Dadaista

Active Member
Licensed User
Longtime User
Hi

Hi know this post is old, but the title of my post would be the same


That code
B4X:
SMTP.AuthMethod = SMTP.AUTH_LOGIN
does not work for me :(
 
Upvote 0
Top