Cannot recieve smtps mails while sending from JavaMail

Hi,

I am trying to send/recieve mails via javamail api. Normal Mail without smtp on port 25 i can send.

I have set up the smtps on port 465.

Properties are set as follows.

properties.setProperty("mail.smtp.host", host);
properties.setProperty("mail.smtp.user", sender);
properties.setProperty("mail.smtp.starttls.enable", "true");
// properties.setProperty("mail.smtps.ssl.protocols", "TLSv1.2");
 properties.setProperty("mail.smtp.auth", "true");  
properties.setProperty("mail.smtp.port", "465");
properties.setProperty("mail.smtp.password", "*******");
properties.setProperty("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");

Sender and Reciever are in same domain.

String recipient = "hitman@rohitnunna.com"; 

// email ID of Sender. 
String sender = "msd7@rohitnunna.com"; 

// using host as localhost 
String host = "127.0.0.1"; 

Please help.

Hi
In this case you also need to enable SSL certificate to can communicate with 465.
For further investigation you can set smtp-in and processing module log level on “Protocol communication”:
WEBADMIN > SERVICES > SMTP Receiving > Service Configuration > Logging
and
WEBADMIN > QUEUE > Processing > Service Configuration > Logging

Hi Mohammad,

Thanks for the quick response.

I see this error after enabling the protocol level logging.

2020-08-03 15:29:11 +0530 02 LAPTOP-RKEA2THQ WEBADMIN:00000000: SSL alert remote 127.0.0.1:62842, undefined:fatal:certificate unknown
2020-08-03 15:29:11 +0530 02 LAPTOP-RKEA2THQ WEBADMIN:00000000: SSL alert remote 127.0.0.1:62843, undefined:fatal:certificate unknown
2020-08-03 15:29:11 +0530 02 LAPTOP-RKEA2THQ WEBADMIN:00000000: SSL alert remote 127.0.0.1:62844, undefined:fatal:certificate unknown

Seems like this is something to do with certificate.

Can you please suggest me what needs to be done here?

We are still at the review stage hence we are not considering the paid certificates from CA for now.

Can you please suggest me some other free alternative?

Hi
There is some notes:
1- These line related to WEBADMIN as you can see in the 6th column.
2- These are because you are connecting to WEBADMIN through IP instead of FQDN.

PLease search for SMTP-IN in 6th column after send a test mail.
In my experience your code is not able to communicate with SSL certificate yet.

You can give a valid SSL Certificate for Let’s Encrypt with the below guide:

I think this has got nothing to do with the WebAdmin stuff maybe(because we’re connecting via the JavaMail API)! Am I missing something here?

Also Can you let me know what can be done to resolve this? replace the 0000 with the FQDN?

just search for SMTP-IN logs

I cannot find this piece of text in the SMTP log.

Does your 465 port enabled?

Yes it is. Listening on 127.0.0.1

@indreias can help better

Hello,

Let’s check if your localhost listener you have configured with SSL on port 465 for SMTP-Incoming service is working well.

For this please provide the output of the following command (to be ran from the console of your Axigen server)

echo -e "ehlo this-is-a-test\nquit" | openssl s_client -connect localhost:10465 -crlf -ign_eof 2>&1| tee /tmp/this-is-a-test.tx

Note: the output should be saved in /tmp/this-is-a-test.txt file so you could just attach to your answer.

BR,
Ioan

Will these commands work for windows?

Hello,

Obviously not and its first time you’ve mention that your Axigen is running on Windows.

In this case just share here the axigen.cfg configuration file so we could check your configuration.

BR,
Ioan

was asking this because of “openssl” you mentioned in the command.

axigen.txt (50.6 KB)

Axigen.cfg file

Please note i cannot run this command. I get following error.
openssl’ is not recognized as an internal or external command,
operable program or batch file.

as this is windows os

Hello,

1/ Checking 127.0.0.1:465 listener from axigen.cfg didn’t pop up any red lights.

2/ We see that SMTP-IN is saved in a separate log file (smtp.txt). Could you please share it as well?

BR,
Ioan

Thank you for response.

smtp (1).txt (51 Bytes)

Seems like this file is empty.