B4J Question sending email through exchange problem

Nokia

Active Member
Licensed User
Longtime User
I’m using the JNet library and have a form that sends emails out.. when I set the setting to send emails out through a godaddy.com pop mail server it works fine. When I try to send out through an exchange server I keep getting error message: java.lang.RuntimeException: Empty writer returned: 503 5.5.2 Need rcpt command.



The funny thing is if my put may exchange email as the from and to address it works fine but not when I send out.



I have tried a few different pop servers and they work and tried 3 different exchange servers and version and I always get the same error.



Has anybody else had this issue?

I have looked at the configuration and can't see why anything would be blocking it..
 

Nokia

Active Member
Licensed User
Longtime User
There are several relevant settings:

1. StartTLSMode or UseSSL.
2. AuthMethod - three options.


sorry didn't see this till now.. must have missed the email notification.. I have tried them modes and nothing works..

2017-11-29 02:10 PM: SUB:Main.Email_sent_event:1 Event:javax.net.ssl.SSLException: 500 5.3.3 Unrecognized command


2017-11-29 02:10 PM: SUB:Main.Email_sent_event:1 Event:javax.net.ssl.SSLException: 500 5.3.3 Unrecognized command


2017-11-29 02:11 PM: SUB:Main.Email_sent_event:1 Event:javax.net.ssl.SSLException: 500 5.3.3 Unrecognized command


2017-11-29 02:11 PM: SUB:Main.Email_sent_event:1 Event:javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

2017-11-29 02:11 PM: SUB:Main.Email_sent_event:1 Event:javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

2017-11-29 02:11 PM: SUB:Main.Email_sent_event:1 Event:javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
 
Upvote 0

Nokia

Active Member
Licensed User
Longtime User
I know that other developers were able to send emails with StartTLS and AUTH_LOGIN.
There could be several different ports. You need to starttls port.

from what I am reading TSL is a sub security layer for smtp (port 25).. this is what I get when using port 25

2017-11-30 02:56 PM: SUB:Main.Email_sent_event:1 Event:javax.net.ssl.SSLException: 500 5.3.3 Unrecognized command

this is what I get when I use port 465

2017-11-30 02:56 PM: SUB:Main.Email_sent_event:1 Event:sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

it would be nice for them other developers to jump on and explain how they did this...


this is my code sample:

B4X:
  SMTP.Initialize(strServerAdr, iPort, strUser, strPassword, "SMTP")
   Select Case iMode
     Case 1
       SMTP.StartTLSMode = True
     Case 2
       SMTP.UseSSL = True
   End Select
   Select Case AuthMode
     Case "Plain"
       SMTP.AuthMethod = SMTP.AUTH_PLAIN
     Case "Login"
       SMTP.AuthMethod = SMTP.AUTH_LOGIN
     Case "Cram Md5"
       SMTP.AuthMethod = SMTP.AUTH_CRAM_MD5
   End Select
   SMTP.HtmlBody = chkUseHtml
   SMTP.Sender = strMailFrom
  SMTP.To = strTo
  SMTP.Subject = "Test message"
  SMTP.Body = " This message is sent to indicate the email setting for software configuration are correct"
   
   
  SMTP.Send
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…