I have followed the below steps to configure sendmail

  1. apt-get install sendmail
  2. add the below content in /etc/mail/auth/client-info

     AuthInfo:<gworks.yyy> "U:<mail@gworks.yyy>" "I:<mail@gworks.yyy>" "P:<xxxxxxx>"
  3. sudo bash -c "cd /etc/mail/auth/ && makemap hash client-info < client-info"
  4. add the below lines in /etc/mail/sendmail.mc before MAILER_DEFINITIONS

    define(SMART_HOST', <gworks.yyy>)dnl define(confAUTH_MECHANISMS', EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl FEATURE(authinfo', `hash /etc/mail/auth/client-info')dnl

  5. sudo bash -c "cd /etc/mail/ && m4 sendmail.mc > sendmail.cf"
  6. service sendmail restart

Test with telnet command

telnet command from remote host throws error Relaying denied

root@e5eae2c464a7:/var/www/public# telnet 25
Connected to
Escape character is '^]'.
220 cthree.gworks.yyy ESMTP Sendmail 8.15.2/8.15.2/Debian-3; Tue, 11 Oct 2016 06:45:28 GMT; (No UCE/UBE) logging access from: development.internet(OK)-development.internet []
helo server
250 cthree.gworks.mobi Hello development.internet [], pleased to meet you
mail from: mail@gworks.yyy
250 2.1.0 mail@gworks.yyy... Sender ok
rcpt to: mail@gworks.yyy
550 5.7.1 mail@gworks.yyy... Relaying denied   

what I did wrong here why it is not get send mail from remote host?


Sendmail by default refuses relaying (accepting messages from external hosts to external email addresses).

You may allow relaying based on sending host IP address or after SMTP AUTHentication.

To allow relaying based on sending host IPv4 address use one of the following entries in access file (access file requires compilation using makemap):

# relay if connection from
connect:  RELAY
# relay if connection from
connect:10.2.0    RELAY
# relay if connection from
connect:10.3      RELAY

WARNING: IMHO relaying based only on IP address without any additional checks is fit as permanent solution only for small nets/sites. Spammers and hackers make it unfit for bigger nets.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.