Configure sendmail as a smart host

Smart host is very handy if you are on dial up network or sometimes a host finds mail that it is unable to deliver directly to the desired remote host.

ADVERTISEMENTS

In large network, it is good idea to have a single host/mail server acting as MTA. Smart hosts are usually used when all other methods of delivery have failed. In the case of the organization with the private network, it would be perfectly reasonable to have the hosts attempt to deliver mail directly first, and if that fails then to send it to the smart host. This relieves the smart host of a lot of traffic because other hosts can directly send mail to other hosts on the private network.

The SMART_HOST macro allows you to specify the host that should relay all outgoing mail that you are unable to deliver directly, and the mail transport protocol to use to talk to it.

Open your configuration file:# vi /etc/mail/sendmail.mcAppend or modify macro that read as follows :define(`SMART_HOST',`smtp.net4india.com')Replace smtp.net4india.com with your actual smtp server address. If line contains word, dnl remove the dnl word. Regenerate a new sendmail.cf config file with m4 command:# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cfRestart sendmail service:# /etc/init.d/sendmail restart

See also:

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
3 comments… add one
  • Renato Tictic Mar 13, 2008 @ 0:14

    I can’t send emails (sendmail) to other domains in the internet. I can send mails to yahoo.com but to some domains it bounce back, giving me a message of unknown host.

    How can I correct this?

  • Nilesh Jun 28, 2008 @ 10:13

    How to do conditional SMART HOSTING based on FROM header ?

    For example, I set from address in an email of mine to my gmail address, then it should go via Gmail’s SMTP with my *GMAIL* account; otherwise it should go via my Google Apps account.

  • John Jul 29, 2014 @ 18:36

    This is not about configuring sendmail AS a smart host, it’s about configuring sendmail to USE a smart host. The title suggests setting up a server to act AS a smart host rather than just how to relay to an existing one.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.