Useful solutions when you want to test sending emails from your local developments, but you don’t have an SMTP server configured on your personal computer.
Surely this article is for hundreds or thousands of developers who have had or will have this need: you are programming an email sending functionality and you have to configure an SMTP server to know if your emails are being sent correctly. This assumption affects all developers on any platform, be it PHP, ASP.NET, ASP, Python, NodeJS.
If you are testing your pages in a hosting that you have contracted, perhaps you already have configured the SMTP server on that server, so you would have no problems. However, many times when we develop locally, we have a PC where no SMTP server is installed since we do not need them since to send mail we usually use an SMTP from the company that provides us with the email service.
We have written articles to solve these needs in various ways and now we offer you another solution that is very practical, as simple as it is and that can serve us perfectly in most cases. It is about having what is called a “fake SMTP server” or what is the same, a fake SMTP server. You will also find this type of software with the name “dummy SMTP”.
It consists of a program that runs locally, which has typical SMTP ports open for local connections and that responds like a real SMTP server. However, it is false because it does not have the functionality of sending the mail.
That is, the emails are not sent, they remain in the “sending processes” registry of the fake SMTP server so that we can review the outgoing messages and we can analyze their form, content, headers, etc. In this way, even if the messages do not reach their recipients, we can be sure that the programming part is working correctly. For sending emails you can read the list of Free SMTP Servers for Sending Emails in 2020.
Why a “Fake SMTP” or “Dummy SMTP”?
Well, the key is the simplicity of the solution and the compatibility with any operating system and any language. Also the portability and lack of configuration provided by most fake SMTP servers. But I can think of other reasons.
1) Because you don’t need to install an SMTP server at all on your local machine. It is a complication that we can leave for those who like to party or system administrators. Normally in your email program, you end up using the SMTP of the company that offers you the mail service, and generally, this is protected so that it cannot be used indiscriminately with other systems.
2) Because a fake server saves you having to configure many of the characteristics of sending an email. The emails will not “physically” leave your computer, but the fake SMTP server interface will allow you to see what emails have been configured and their form.
3) Because you will save yourself doubts about whether your email delivery schedule is working correctly. Email servers often reject emails sent from “unauthorized” SMTP servers. Your programming may be well done, but the reason for not receiving the email where you should be is that it gets blocked in the recipient for various reasons.
Because the SMTP server you have locally is not configured correctly, because the sender’s domain cannot be sent from the IP that your local computer has. And I assure you that anti-spam servers check many things …
Possible software to have your fake SMTP server:
Now that I have explained the reasons why having our fake SMTP seems like an optimal solution, I am going to offer you some references to programs that you can try. Using them is quite simple since you do not have to configure anything in regards to the program.
It is a program for Windows. You download it, unzip it and place it anywhere. It doesn’t have to be installed, it is a simple .exe executable that, once started, stays as a resident program.
This other program is written in Java, so it is compatible with any operating system, as long as you have the Java virtual machine installed. To start it, if your system allows it, you will simply have to start it as an executable, with a double click on the fakeSMTP.jar. If not, executing the command:
java -jar fakeSMTP.jar
For other indications and settings, consult the program page.
Also developed in Java, you can give us an alternative if necessary.
We download the .jar and then run it, either with a double click, as if it were an executable, or with the command:
java -jar DevNullSmtp.jar
Other fake SMTP servers developed in Java:
I understand that in Java it must be very easy to program a fake SMTP server because on the web there are many other SMTP systems based on this language. Dumbster or subethasmtp are examples of this. Take a look at them if you need to.
Another alternative, where its portability is an advantage: you can carry it in a USB key. They do not bother on their page to explain what operating system it is made for. It is a .exe, so we understand that it is for Windows.
The solution offered as a “web service”, which does not install anything locally, but you have to configure your programming language or framework to be used as if it were an external SMTP server (that is why it differs from other products discussed in this article, which are programs that you install locally, however, may be a good option to analyze).
As they say on their website at the time of writing this article is free, but in the future, they plan to offer it underpayment of a fee still unspecified. The advantage is that you can have in the “cloud” the emails sent by the local computers of the entire development team, to review them and do what you need with them.
It is a solution very similar to Mailtrap since it is a web service that you can use to test your messages. It has several additional advantages and possibilities, but it is paid.
At the moment I think we have enough options to choose the one that we like the best or the one that best suits us. I have only tried smtp4dev, for Windows and the experience has been completely satisfactory. You will tell me which is your favorite.