yum-cron – How to Send Emails from Localhost

cronemailemail-serversmtpyum

I have an amazon linux 2 server running in the aws cloud and I have yum-cron running on it. I have an email domain mydomain.com which is running on a separate server in a completely different cloud environment (bluehost). I have the following settings in /etc/yum/yum-cron.conf:

email_from=myuser@mydomain.com
email_to=security@mydomain.com
email_host=localhost

The above configuration works beautifully and I am asking how exactly does it work? As far as I know sending an email is a somewhat complicated process. You must connect to an SMTP server, provide a hostname, port and login credentials, and when the email is sent its given to that SMTP server which handles the actual sending of the email. Localhost is (as far as I know) NOT an smtp server, so how is yum-cron managing to send emails? I was expecting this configuration to fail.

Best Answer

I would speculate that your amazon linux 2 server running in the aws cloud is running a mail server (probably sendmail or postfix) listening on port 25 probably only on the loopback address (127.0.0.1). Yum-cron "sends" the mail to the mail server running on localhost and then it relays it out to the internet.