Using mail as a part of a script

Hello,
I am currently making a website using Lua behind Apache. See the documentation here: https://httpd.apache.org/docs/trunk/mod/mod_lua.html .

I have the server running on my laptop, along with a MySQL (mariadb) server. I intend to move this website (the Lua scripts) from my laptop onto a Ubuntu server for production once I am done with it.
The problem is that I need to program and test emailing functionality. I currently don’t have a mail server to test it with, nor do I know how to I want to move it from code intended for my testing environment to the production environment.
Any recommendations? I can execute shell commands from Lua or use any libraries for Lua5.2 (preferrably ones that are easy to install, because I am a real idiot on fussing around with Luarocks sometimes).
How would any of you suggest I get test emails sent to my mail client (Thunderbird)? Then, how would any of you suggest I send mail from my website to my mail server (securely)? I am thinking I’ll do a Mail-in-a-Box server, but I’m not sure how I would approach sending automated mail, since certain mailboxes don’t need to be saved.

I am thinking that if I create a function within Lua that sends an email, and keep the input/output and name the same, if I change it from a testing environment to a production environment, it’ll go off without a hitch.

Wait, don’t you have a MIAB setup??? Woah, Dejavu, Wasn’t this asked a year ago?

Anyway, sending mail via MIAB is the same as literally any other SMTP server.

Connect, send a few commands, and quit. A typical SMTP transaction (which you can do manually via telnet ::IP:: 25):

EHLO ::MY_HOSTNAME::

AUTH

::UESRNAMEINBASE64::
::PASSWORDINBASE64::

MAIL FROM:< *sender* @ *address* >
RCPT TO:< *receiver* @ *address* >

DATA
Subject: Hello World!

Here is body text.
.

QUIT

(Yes that is an extra period at the end, on it’s own line.)