Sendmail

http://www.faqs.org/docs/securing/chap22sec185.html

How to setup an E-Mail Relay Host with Sendmail?
http://www.cyberciti.biz/faq/configure-sendmail-as-a-smart-host/
http://www.cyberciti.biz/faq/force-sendmail-to-route-mail-to-specific-hosts-or-mailserver/
http://www.brandonhutchinson.com/Creating_a_new_sendmail_mailer.html
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/sendmail.html
http://www5.us.freebsd.org/doc/en/books/handbook/sendmail.html
http://www.planetlarg.net/open%20source%20cookbook/e-mail/send-message-remote-host-using-sendmail

http://www.faqs.org/docs/linux_network/x15291.html
http://www.sendmail.com/sm/open_source/tips/smtp_relaying/
http://www.active-server.com/blog/creating-an-open-relay-with-sendmail/
http://www.freebsddiary.org/relay.php
http://www.sendmail.org/~ca/email/relayingdenied.html
http://www.ozzu.com/unix-linux-forum/how-setup-relay-host-sendmail-t29690.html

What are the basic steps for working with sendmail configuration file?

  1. Edit the /etc/mail/sendmail.mc
  2. Regenerate the /etc/mail/sendmail.cf from the /etc/mail/sendmail.mc file
    1. sudo chmod 666 /etc/mail/sendmail.cf
    2. sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
    3. sudo chmod 644 /etc/mail/sendmail.cf
  3. Restart sendmail

How can we regenerate /etc/mail/sendmail.cf from /etc/mail/sendmail.mc?

sudo chmod 666 /etc/mail/sendmail.cf
sudo m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf 
sudo chmod 644 /etc/mail/sendmail.cf

How can we restart sendmail?

sudo /etc/init.d/sendmail restart

How can we restart Sendmail in debug mode?

sudo /etc/init.d/sendmail restart -bD -O LogLevel=20 -X /tmp/sendmail.log

How can we verify your configuration by generating a deliverability report?

sudo sendmail -bv user@example.com

In this report, look for the following output:

user@example.com... deliverable: mailer awsemail, host example.com, user user@example.com

How can we to send a test email?

sudo /usr/bin/sendmail -f from@example.com to@example.com

Type your message and put a dot on a single line by itself or press CTRL+D. We can also create a test file to_internet:

To: martin.zahn@plenaxx.ch
From: martin.zahn@arkum.ch
Subject: Ein Test

Dies ist ein Header Test
(empty line)

and then do:

cat to_internet | /usr/lib/sendmail -bm -t -v
/usr/lib/sendmail -vt

How can we show the delivery agent (debug)?

/usr/lib/sendmail -d0.12 -bt < /dev/null

How can we show macros without $u, $M which will be set when mail is already delivered (debug)?

/usr/lib/sendmail -d35.9 -bt

How can we show sendmail queue?

/usr/lib/sendmail -bp

How can we test the MX-Record readed by Sendmail from DNS?

/usr/lib/sendmail -bt

How can we configure smart host?

Edit /etc/mail/sendmail.mc:

define(`SMART_HOST',`smtp.net4india.com')

How can we configure sendmail to relay mail through another server?

  1. Open up /etc/mail/sendmail.mc
  2. Search for SMART_HOST
  3. Remove the dnl (delete through newline) prefix.
  4. Save the file
  5. Regenerate the sendmail.cf file.

If you do not use m4, open up /etc/mail/sendmail.cf, search for DS, and update it to:

DS[192.168.4.11]

What is the purpose of mailertable?

mailertable allows you to route or deliver mail to different hosts. Edit /etc/mail/sendmail.mc to include:

FEATURE(`mailertable')

and edit /etc/mail/mailertable to include:

192.168. smtp:mail.myisp.com
nixcraft.com smtp:p5.mail4india.com

Now build database version of the mailertable is built using:

makemap hash /etc/mail/mailertable

Other useful debugging commands:

http://www.planetlarg.net/open%20source%20cookbook/e-mail/send-message-remote-host-using-sendmail

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License