TransWikia.com

How to send email from AWS Lightsail using commandline tools

Super User Asked by wervolv on November 12, 2021

I’m running a simple script on a Lightsail Debian instance to monitor my home router (Fritzbox). The script is testing (via OpenSSH) if the router is up; this works fine. Now I want it to send me an email if the router is down.

I tried the command line tools mail and sendmail. They execute without an error message, but there is no mail at the receiving mailbox (checked spam folder). I don’t want to use SES, WordPress, Plesk, or something just to send myself one or two emails per day.

Can anybody point me in the right direction? Ask AWS support to allow mailing? Firewall config? Something else?

One Answer

Well, the easiest should be to use one of your existing mail accounts and send mail via them. First you need to request from AWS support that they open up the SMTP ports to reach any mail server in the Internet via the standard ports (which are actually blocked otherwise).

Then you can use any SMTP client, e.g. from OS or if you prefer script languages, you can do with Perl or the like (e.g. Mail::Sender). You will find plenty of configuration examples in the Internet.

Answered by fratester on November 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP