I have multiple Ubuntu servers with Java applications running on it. One of the application's functions is to sent an email. Now we using exim4 as the MTA.I would like to replace exim with something lighter. My first idea was msmtp or ssmtp.Mail from command line gone well, but then I found the problem:Java application trying to sent an email on localhost:25 and getting the following exception:javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25    Caused by: java.net.ConnectException: Connection refusedand it is correct behavior since msmtp/ssmtp does not listen on localhost:25.I am not able to change the Java code, so I need to pick up an email on localhost:25 on server and then put it to central mailserver through SMTP. Is there any way to run msmtp/ssmtp as a daemon listening on localhost:25 ? Or maybe forward localhost:25 to msmtp/ssmtp's STDIN somehow?
Lightwight MTA which could listen on localhost port
port forwarding;mail transport agent
I've managed to change Java code from localhost to mailserver address