You are here

Linux Sendmail to an SMTP server

I used these sendmail.mc and access files to cause sendmail to use my ISPs smtp server.

/etc/mail/sendmail.mc

include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
define(`SMART_HOST',`mail.example.com')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
FEATURE(`access_db', `hash -T -o /etc/mail/access.db')dnl
FEATURE(`authinfo',`hash /etc/mail/access.db')dnl
FEATURE(`no_default_msa',`dnl')dnl
FEATURE(`smrsh',`/usr/sbin/smrsh')dnl
FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
MASQUERADE_AS(`dfwavc.com')dnl
FEATURE(masquerade_envelope) FEATURE(genericstable, `hash -o /etc/mail/genericstable')dnl
dnl GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl

Then type the following:

# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

/etc/mail/access

# Check the /usr/share/doc/sendmail/README.cf file for a description
# of the format of this file. (search for access_db in that file)
# The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc
# package.
#
# If you want to use AuthInfo with "M:PLAIN LOGIN", make sure to have the
# cyrus-sasl-plain package installed.
#
# By default we allow relaying from localhost...
Connect:localhost.localdomain RELAY
Connect:localhost RELAY
Connect:127.0.0.1 RELAY

AuthInfo:mail.example.com "U:smmsp" "I:shanon@example.com" "P:mypassword" "M:PLAIN"

and type:

# makemap -r hash access.db < access

and restart sendmail.

Got this from: Linux Home Automation