Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Mail Servers»How to Install Sendmail on Fedora 32/31/30

    How to Install Sendmail on Fedora 32/31/30

    RahulBy RahulFebruary 11, 20193 Mins ReadUpdated:May 19, 2020

    Sendmail is a general purpose email routing facility used for email transport over the Internet. It includes SMTP (Simple Mail Transfer Protocol) for the mail-transfer and email delivery. Most of the system administrators preferred to use Sendmail server as MTA than other MTAs. You can also use Sendmail server to send the email via external SMTP servers like Gmail, Amazon SES, MailChimp etc.

    1. Install Sendmail

    If you don’t have installed Sendmail using the following command to install Sendmail with other required packages using yum package manager.

    sudo dnf install sendmail sendmail-cf
    

    2. Configure Sendmail on Fedora

    Before starting configuration we must know about various Sendmail configuration files exists in /etc/mail directory.

    • access — Allow/Deny other systems to use Sendmail for outbound emails.
    • domaintable — Used for domain name mapping for Sendmail.
    • local-host-names — Used to define aliases for the host.
    • mailertable — Defined the instructions that override routing for particular domains.
    • virtusertable — Specifies a domain-specific form of aliasing, allowing multiple virtual domains to be hosted on one machine.

    2.1 Comment out below line in /etc/mail/sendmail.mc to allow receiving email from anywhere. To comment a line in sendmail.mc, just put dnl at start of line.

    dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
    

    2.2 Add this line also in sendmail.mc above ‘MAILER’ option

    FEATURE(`relay_hosts_only')dnl
    

    2.3 Add your PC’s full hostname in this file.

    hostname >> /etc/mail/relay-domains
    

    3. Recompile Configuration File

    m4 ia a macro processor to compile the Sendmail configuration files. m4 is stream-based, that is, it doesn’t understand about lines.

    sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
    

    Restart Sendmail service

    sudo systemctl restart sendmail
    

    4. Configure Domain-based E-mail Routing

    As we read above that virtusertable file used for aliasing, allowing multiple virtual domains to be hosted on one machine.

    • 1. All emails addressed to @example.com domain delivered to [email protected]
      @example.com [email protected]
      
    • 2. All emails addressed to [email protected] will forward to local user jack.
      [email protected]  jack
      
    • 3. All emails addressed to @mydomain.com will forward to domain @otherdomain.com with corresponding usernames.
      @mydomain.com    %[email protected]
      
    • 4. All emails addressed to @otherdomain.com will be rejected my mail server with acknowledging sender with the message
      @otherdomain.com 	 error:nouser User unknown
      

    After making all changes in virtusertable execute following command to create updated virtusertable.db file containing the new configuration.

    makemap hash /etc/mail/virtusertable < /etc/mail/virtusertable
    

    Finally, restart the Sendmail service to apply changes

    sudo systemctl restart sendmail
    

    Thanks for reading this article. I hope this article will help you to configure Sendmail on Fedora systems.

    References:
    http://www.sendmail.com/
    http://www.sendmail.com/sm/open_source/docs/m4/intro_m4.html

    fedora mail sendmail smtp
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Pass Password to ssh/scp Command in Bash Script
    Next Article How to Install Sendmail on Debian 9 (Stretch)

    Related Posts

    Top 5 Most Stable Linux Distributions in 2022

    Updated:January 11, 20226 Mins Read

    How to Install and Configure Postfix on Ubuntu 20.04

    5 Mins Read

    How to Install Anaconda on Fedora 35/34

    Updated:April 18, 20224 Mins Read

    Top 10 Best Linux Server Distributions in 2022

    Updated:April 1, 20228 Mins Read

    How To Install and Configure Drupal on Fedora 35/34

    Updated:February 15, 20224 Mins Read

    How to Disable SELinux on Fedora

    Updated:July 12, 20213 Mins Read

    1 Comment

    1. Aaron Sloman on August 7, 2020 4:04 pm

      Thank you very much for this tutorial. In the past I’ve struggled to get sendmail working on new machines, and sometimes after an OS upgrade. This tutorial could have saved me a lot of wasted time. However there is a small item that could be added. My first attempt to use sendmail after following your instructions produced what seemed to be a ‘hung’ sendmail process, with this message:

      ‘sendmail.service: Can’t open PID file /run/sendmail.pid (yet?) after start: Operation not permitted’

      After a little research I found the solution here: https://linuxconfig.org/sendmail-unqualified-hostname-unknown-sleeping-for-retry-unqualified-hostname

      i.e.
      sendmail is searching for a FQDN ( fully qualified domain name ). In our case the host name is “debian” and that is not a FQDN. To resolve this problem change /etc/hosts: FROM:

      127.0.0.1 localhost
      127.0.1.1 debian

      TO:

      127.0.0.1 localhost.localdomain localhost debian
      127.0.1.1 debian

      I suggest that your tutorial would be even more valuable to more people if you included that tip (replacing ‘debian’ with the hostname of the machine being used).

      Thanks
      Aaron Sloman

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    • (Resolved) Please install all available updates for your release before upgrading
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.