I've got one Debian server with access to the Internet and Apache installed on it, and it can connect to email server by static IP.
There is the second Debian server behind firewall without access to the Internet and Java application on it, it can connect ot the first server only.
Can I configure apache such as it listens to port (for example 8081) and redirects it to mail server in order to send email messages on second server?
I tried this:
1) configure second server to send email to the first server using port 8081 (not 25).
2) add new port in /etc/apache2/ports.conf and to add new VirtualHost as described below.
<VirtualHost "*:8081">
#VirtualHost for email server
ProxyRequests On
ProxyPass / http://mail_server_ip:25/
ProxyPassReverse / http://mail_server_ip:25/
<Location />
Order Deny,Allow
Allow from all
</Location>
</VirtualHost>
But nothing meaningful happens, only SocketTimeoutException and javax.mail.MessagingException: Exception reading response.
Is Apache suitable for this task? Is there any way to do it properly?