Category: Sendmail & Postfix

Sendmail & Postfix

How to smarthost on linux using sendmail

How to smarthost on linux using sendmail

This will describe you how to set up a smarthost using sendmail. This is to send emails using your
linux server as your smtp server, and it will use your ISP email server to send all your emails through it, to the final users.

For setting up smarthost you have to add open relay smtp in your /etc/hosts
111.111.111.111 smtp.yourdomain.com
222.222.222.222 smtp.yourdomain.com

Now open /etc/mail/sendmail.mc
and find SMART_HOST
edit with your smtp domain, example below

define(`SMART_HOST’, `smtp.yourdomain.com’)dnl

now add belows 4 line at the end of /etc/mail/sendmail.mc above “MAILER(smtp)dnl”

FEATURE(masquerade_envelope)dnl
FEATURE(`genericstable’)dnl
GENERICS_DOMAIN(`localhost.localdomain’)dnl
FEATURE(`authinfo’, `hash /etc/mail/authinfo’)

save and close the sendmail.mc file

Now follow the steps below

$ vi /etc/mail/genericstable
root ravi@yourdomain.com

arun arun@yourdomain.com

list your users, default is root, save and exit

now run the following command.
$ makemap hash /etc/mail/genericstable < /etc/mail/genericstable

$ vi /etc/init.d/authinfo
AuthInfo:smtp.yourdomain.com “U:arun@smtp.yourdomain.com” “I:arun” “P:password” “M:LOGIN PLAIN”

save and exit authinfo and run
makemap hash /etc/mail/authinfo < /etc/mail/authinfo
chmod 600 /etc/mail/authinfo

Now apply all changes to sendmail.cf to run following command

$ make -C /etc/mail

and last restart the sendmail service
service sendmail restart ; chkconfig sendmail on

Now you can send emails from command line using your external smtp server.

Thanks

Ravi