Hi,
I used to send emails from my already existing B4A existing app as well as from my PHP Webapplication.
Few days back I changed the Email Service provider. The new service provider uses SSL.
In my PHP web application the following code works fine now and I am able to send email successfully.
I am unable to send emails from the same email server using B4A with the following code which is equivalent to the above given PHP code
The email is not sent and I get the following LastException.Message
java.lang.RuntimeException: Empty writer returned: 503 5.5.1 Error:need RCPT command
Tried SMTP.UseSSL = True along with above given code, but I get the same error as statd above in red color
I tried different combinations like StartTLSMode = True, UseSSL = True etc
Contacted the service provider and collected the log and as per them the following is the log and their explanation
LOG from the Email Service Provider :-
Jul 7 12:12:26 mail postfix/submission/smtpd[16044]: NOQUEUE: reject: RCPT from unknown[My IP Address]: 554 5.7.1 <unknown[My IP Address]>: Client host rejected: Access denied; from=<email_ID@ThatIusedToSendEmail.com> to=<MYRecipent@emailaddress.com> proto=ESMTP helo=<MyLanIP>
Explanation from the Email Service Provider :-
The above error is generated in the mail log: This issue occurs when the username/password is not passed through successfully to our server. If the username/password is not passed to our server successfully, the server will block the IP from establishing a connection to our MTA. (Mail Transfer Agent).
If I use
The email is not sent and I get the following LastException.Message
javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb7ba0e88: Failure in SSL library, usually a protocol error
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0x96f92926:0x00000000)
The php code used to send email is working fine on the same server.
May I know how to enable "My Server require authentication" via SMTP
Is the code SMTP.AuthMethod = SMTP.AUTH_LOGIN is what that does the above ?
It is not an Internet Service provider issue blocking port 587, I tried sending the email using the Emulator, My Phone via 4G and from my phone via Wi-Fi
Any hep will be appreciated.
Regards
Anser
I used to send emails from my already existing B4A existing app as well as from my PHP Webapplication.
Few days back I changed the Email Service provider. The new service provider uses SSL.
In my PHP web application the following code works fine now and I am able to send email successfully.
B4X:
$mail = new PHPMailer;
$mail->Host = "mail.myemailserver.com";
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "myusername@myemailserver.com";
$mail->Password = "MyPassword";
I am unable to send emails from the same email server using B4A with the following code which is equivalent to the above given PHP code
B4X:
iPort = 587
SMTP.Initialize(sServer, iPort, sUser, sPW, "SMTP" )
SMTP.AuthMethod = SMTP.AUTH_LOGIN '
SMTP.StartTLSMode = True
The email is not sent and I get the following LastException.Message
java.lang.RuntimeException: Empty writer returned: 503 5.5.1 Error:need RCPT command
Tried SMTP.UseSSL = True along with above given code, but I get the same error as statd above in red color
I tried different combinations like StartTLSMode = True, UseSSL = True etc
Contacted the service provider and collected the log and as per them the following is the log and their explanation
LOG from the Email Service Provider :-
Jul 7 12:12:26 mail postfix/submission/smtpd[16044]: NOQUEUE: reject: RCPT from unknown[My IP Address]: 554 5.7.1 <unknown[My IP Address]>: Client host rejected: Access denied; from=<email_ID@ThatIusedToSendEmail.com> to=<MYRecipent@emailaddress.com> proto=ESMTP helo=<MyLanIP>
Explanation from the Email Service Provider :-
The above error is generated in the mail log: This issue occurs when the username/password is not passed through successfully to our server. If the username/password is not passed to our server successfully, the server will block the IP from establishing a connection to our MTA. (Mail Transfer Agent).
If I use
B4X:
SMPT.UseSSL = True
SMTP.StartTLSMode = False
SMTP.AuthMethod = SMTP.AUTH_LOGIN
The email is not sent and I get the following LastException.Message
javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb7ba0e88: Failure in SSL library, usually a protocol error
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:766 0x96f92926:0x00000000)
The php code used to send email is working fine on the same server.
May I know how to enable "My Server require authentication" via SMTP
Is the code SMTP.AuthMethod = SMTP.AUTH_LOGIN is what that does the above ?
It is not an Internet Service provider issue blocking port 587, I tried sending the email using the Emulator, My Phone via 4G and from my phone via Wi-Fi
Any hep will be appreciated.
Regards
Anser
Last edited: