Configure sendmail for SMTP relay with your ISP

http://cri.ch/linux/docs/sk0009.html

I have copied the document from the above link without modifications

Author:  Sven Knispel
Updated:  05-01-2005
Feedback welcome: linux@cri.ch
Free service provided by: www.cri.ch

The following article explains the setup of sendmail for forwarding mails to your ISP\’s smtp server.
It is assumed that you have sendmail up-to-date and configured properly.
Note: this setup does not work properly for smtp-server using

1
SASL

(e.g. like

1
smtp.pobox.com

)
Most of the commands must be executed with the corresponding rights (using

1
sudo

).

1. configure your smtp-server

(this requires that you have the package

1
sendmail-cf

installed)

1.1. changes to

1
/etc/mail/sendmail.mc

Uncomment the definition

1
SMART_HOST

and add the correspondign

1
FEATURE

to it:

1
            define(`SMART_HOST\', `your-smtp-server\')<br />            FEATURE(authinfo)dnl

Note: Please note, that these are \”oriented\” quotes.

1.2. create the new

1
sendmail.cf

Stop sendmail by issuing the command

1
/sbin/service sendmail stop

and log on as

1
root

to issue this command.

1
            m4 /etc/mail/sendmail.mc &gt; /etc/mail/sendmail.cf
1
 

1.3. Define the account information for connecting to the smtp-server

Edit/create

1
/etc/mail/authinfo

and add the following line:

1
              AuthInfo:&lt;your-smtp-server&gt; \"U:&lt;your-smtp-user&gt;\" \"P:&lt;your-smtp-password&gt;\" \"M:DIGEST-MD5\"

Note:The

1
M:

may vary depending on the capabilities of the smtp-server (e.g.

1
CRAM-MD5, PLAIN

).

Create

1
authinfo.db

:

1
              makemap hash /etc/mail/authinfo &lt; /etc/mail/authinfo

and finally restart sendmail:

1
                /sbin/service sendmail restart

1.4. Configure header rewriting (optional)

Header rewriting consists in replacing the

1
From:

and

1
Reply to:

in the header of an outgoing mail in order for the recipient to reply to a valid address.
This can be set by editing the file

1
/etc/mail/userdb

:

1
&lt;local-name&gt;:mailname &lt;email-adsress&gt;

E.g.:

1
              # /etc/mail/userdb <br />              sven:mailname sven@foo.org

Finally create the corresponding database:

1
              makemap btree /etc/mail/userdb.db &lt; /etc/mail/userdb

… and finally restart sendmail:

1
                /sbin/service sendmail restart

1.5. Test your settings

Issue following commands and check the trace for verifying the delivery path:

1
              /usr/sbin/sendmail -bv root@localhost

Should show a \”local\” delivery.

1
              /usr/sbin/sendmail -bv &lt;your-mail&gt;@&lt;your-domain&gt;

Should show a delivery path through your ISP.

For troubleshooting you should check the mail-log:

1
/var/log/maillog

2. Forwarding

Forward can be defined in

1
~/.forward

. (just enter the e-mail addressto forward to). Note:The permissions of that file must be adjusted correspondingly in order to avoid sendmail ignoring it (see

1
/var/log/maillog

in case of problems).

3. References

For further information I recommend to check following link:

About Amit Agarwal

2 Comments on “Configure sendmail for SMTP relay with your ISP”