On my development machine, I have a special kind of SMTP server running on non-standard port which is used for testing purposes.

On my virtual machine I'm trying to push a message to that SMTP server by using Exim4's sendmail app:

selenium-node$ sendmail -t
To: root@my-development-machine.testingnetwork.local:2525
From: apache@my-selenium-node.testingnetwork.local
Subject: Test message

Quick brown fox jumps over the lazy dog

However, it looks that default SMTP server on my-development-machine.testingnetwork.local:25 receives my message instead.

Is there a clean and natural way to do what I'm trying for? Modifying some configs on my-selenium-node.testingnetwork.local is no problem.


SMTP always goes to TCP/25 unless the mail delivery agent (here, sendmail as implemented by Exim) is specifically configured to send the mail to some custom port. There is no means to set the port like there is in URL from the mail user agent that talks to the mail delivery agent. Options thus are limited to reconfiguring Exim to send to a different port or to use some other mail sending program to direct the mail elsewhere, such as ssmtp with configuration in ssmtp.conf along the lines of


and then piping the message to ssmtp. Another option would be to use a SMTP client module in some programming language; these may support sending to arbitrary TCP ports.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.