1

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 10.1.2.3 25
Trying 10.1.2.3...
Connected to 10.1.2.3.
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 [10.1.2.4]
helo server
250 cthree.gworks.mobi Hello development.internet [10.1.2.4], 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?

Bilal Usean
  • 171
  • 1
  • 1
  • 14

1 Answers1

1

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 10.1.2.4
connect:10.1.2.4  RELAY
# relay if connection from 10.2.0.0/24
connect:10.2.0    RELAY
# relay if connection from 10.3.0.0/16
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.

AnFi
  • 6,103
  • 1
  • 14
  • 27