To configure sendmail
as a smart host, you will need to edit the sendmail.mc
configuration file and add the following lines:
define(`SMART_HOST',`smtp.example.com')dnl define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl FEATURE(`authinfo',`hash -o /etc/mail/auth/authinfo.db')dnl
Replace smtp.example.com
with the hostname or IP address of the smart host.
Next, create the authinfo.db
file by running the following command:
makemap hash /etc/mail/auth/authinfo.db < /etc/mail/auth/authinfo
Then, add the following lines to the authinfo
file:
AuthInfo:smtp.example.com "U:username" "I:username" "P:password"
Replace username
and password
with the login credentials for the smart host.
Finally, regenerate the sendmail.cf
configuration file by running the following command:
make -C /etc/mail
Restart the sendmail
service to apply the changes:
systemctl restart sendmail
After completing these steps, sendmail
should be configured to use the specified smart host for all outbound email.