I recently set up a security camera and wanted to be able to mail myself security events. The first thing I had to do was get AT&T to open port 25 from my house. This was painlessly done by asking an agent in the online support chat. Within a minute of asking if it can be done, the agent had the port open and I was able to connect out on port 25.
The next step was to configure my MTA to send outbound mail. I chose to set this up on my “linux utility box” because it is online all the time and I will likely want to set up some emailing from it now that I have it working. I had previously installed exim4 in an attempt to get outbound mail working, but was unsuccessful due to the block at AT&T. To reconfigure the package, I simply ran ‘dpkg-reconfigure exim4-config’ and walked through all the steps.
A couple things that I changed from default were to:
- Define the FQDN, which I set to mirror the FQDN that I set up with afraid.org
- Defined the server as “internet connected” so that it would send mail directly instead of needing a smarthost
- Allowed relay connections from my private IP range
- Set it to listen on the primary ethernet interface
Once I had set this up, I tested the functionality with a simple command:
echo “This will go into the body of the mail.” | mail -s “Hello world” [email protected]
Almost immediately the mail showed up in my mailbox with my full name as the sender and the previously defined FQDN as the sending domain. Very cool!
The next step was to configure the system running zoneminder to use my utility server as a relay. After looking at some logs on the Zoneminder server, I found that it was running nullmailer, which I learned is a very lightweight MTA and should be perfect for my situation. I was able to configure it appropriately by running ‘dpkg-reconfigure nullmailer’ and running through the steps. Again, the only thing I had to do was define my FQDN (used the same as before) and define the relay host as my utility server. I tested mailing from this server using the same mail command as above, and I received the mail immediately. Mission accomplished, I can now send mail from 2 of my servers.