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

joaquinortiz

Active Member
Licensed User
Longtime User
I have the following code and when I send an e-mail attaching a file, it shows me this message.

Send mail:
            '///////////////////////////////////////////////////
            myEmail.gEmailTO = txtEmailTo.Text
            '///////////////////////////////////////////////////
            'Asigna el nombre del archivo
            lExcelFileName = myGlobalVariables.gExcelQuickSCAN & "_" & fechahoy & TimeHoy & ".xls"
'            fcnExportaEntradas(lExcelFileName)
            myAccess.ExportaReciboCiegoEXCEL(lQuery,lExcelFileName)
            ''''''''''''''''''///////////////////////////
            Dim mail As SMTP
            mail.Initialize(myEmail.gServerOUT,myEmail.gPortOUT,myEmail.gEmailFROM,myEmail.gEmailPassword,"mail")
            mail.AddAttachment(myGlobalVariables.gSQLDataBasePath,lExcelFileName)
            mail.UseSSL = True
            mail.To.Add(myEmail.gEmailTO)
            mail.HtmlBody = True
            mail.Body = myEmail.gEmailBODY 'html.ToString
            myEmail.gEmailSubject = myGlobalVariables.gSistema & " - Archivo adjunto " & lExcelFileName
            mail.Subject = myEmail.gEmailSubject 'title
            Dim obj As Object = mail.Send
            wait for (obj) mail_MessageSent(Success As Boolean)
            If Success Then
'                blnSendFile = True
'                'ToastMessageShow("Enviado correctamente",False)
                Msgbox2Async("Se enviĆ³ el archivo excel " & lExcelFileName & " al correo: " & txtEmailTo.Text.Trim, myGlobalVariables.gSistema, "Si", "", "No", Null, False)
                Wait For Msgbox_Result (Result As Int)
                If Result = DialogResponse.POSITIVE Then
                    SalirFormulario
                End If
            Else
                Msgbox2Async("No se pudo enviar el archivo excel: " & CRLF & LastException.Message, myGlobalVariables.gSistema, "Si", "", "No", Null, False)
                Wait For Msgbox_Result (Result As Int)
                If Result = DialogResponse.POSITIVE Then
                    SalirFormulario
                End If
'                blnSendFile = False
            End If
WhatsApp Image 2021-09-15 at 9.32.33 PM.jpeg
 

JohnC

Expert
Licensed User
Longtime User
Have you reviewed these threads?



 
Upvote 0

joaquinortiz

Active Member
Licensed User
Longtime User
Have you reviewed these threads?



I'll already check it....let me check it again.

But, there is something that i'm confused.

For example.
IF my sender e-mail is: [email protected]
And my to e-mail is: [email protected] or [email protected]

It shows me this error.

But if I change my e-mailTo to [email protected] <-- It's works and I recieve the e-mail.

What could be the problem?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Upvote 0

joaquinortiz

Active Member
Licensed User
Longtime User
Now, I'm recieveing the following error.

org.apache.commons.net.smtp.SMTPConnectionClosedException: Connection closed without indication
 
Upvote 0

joaquinortiz

Active Member
Licensed User
Longtime User
are you sure that the settings are correct for gmail?
Yes, it's correcto.

The receiver can be: [email protected] or [email protected]

The sender that I'm using is '[email protected]'

mail.Initialize("basicwms.com",465,"[email protected]","mypassword","mail")
mail. UseSSL = True

With this, the error still Error 503 Bad sequence...etc, etc.
I recently talked to my emails provider, and he told me the following.

If the e-mail is not authenticated with the basicwms mail user and mail password then it can only send to the same domain and not outside, but apparently, you are sending it authenticated, check it well and google what may be happening.

Also I tried the following:
mail.Initialize("basicwms.com",587,"[email protected]","mypassword","mail")
mail.StartTLSMode = True

And it throws me the following error:
java.net.ConnectException: Connection Timed out.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Try commenting out the mail.StartTLSMode = True line, and add this line:

Mail.AuthMethod = mail.AUTH_LOGIN
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Did you fix the issue?
 
Upvote 0
Top