4

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 refused 

and 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?

2
  • I think nullmailer fits the bill. Commented Dec 4, 2014 at 1:21
  • @Gilles nullmailer doesn't listen on port 25, it merely provides an implementation of sendmail. Commented Mar 19, 2016 at 13:12

2 Answers 2

1

The links below provides all the MTA choices you can choose, according to your Ubuntu version:

MTA - Ubuntu 12.04

MTA - Ubuntu 14.04

You can also check the Archwiki page on Setting up ssmtp to use port 25.

SSMTP and MSMTP still are not full fledged MTA's. This unix.se provides details for a comprehensive lists of MTA's available and they as well are already packaged for ubuntu.

0

I've managed to change Java code from localhost to mailserver address

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.