Install send mail service on Fedora

Fedora: Install and Configure Authenticated Mail Sending with msmtp and s-nail

Overview

This guide explains how to set up authenticated email sending from the command line on Fedora using msmtp (a lightweight SMTP client) and s-nail (a mailx-compatible mail utility). This method is ideal for scripts and system notifications in environments where only authenticated SMTP is allowed.

1. Install Required Packages

sudo dnf install msmtp s-nail

2. Configure msmtp

  1. Copy the example configuration (optional):
    sudo cp /usr/share/doc/msmtp/msmtprc-system.example /etc/msmtprc
  2. Edit /etc/msmtprc and adjust to your SMTP provider:
    sudo nano /etc/msmtprc

    Example configuration:

    defaults
    auth           on
    tls            on
    tls_trust_file /etc/ssl/certs/ca-bundle.crt
    logfile        /var/log/msmtp.log
    
    account        default
    host           mail.hosting.de
    port           587
    from           admin@simmy.org
    user           admin@simmy.org
    password       <super-secret>

  3. Set permissions to protect your password:
    sudo chmod 600 /etc/msmtprc 

3. Configure s-nail to Use msmtp

Add the following line to /etc/s-nail.rc or your ~/.mailrc:

set mta=/usr/bin/msmtp

4. Send a Test Email

echo "This is the body" | mail -s "Test Subject" recipient@example.com

5. Notes

References


Revision #1
Created 2 May 2025 15:54:44 by Admin
Updated 2 May 2025 15:59:10 by Admin