Monday, June 30, 2008

Relay Mail by not start sendmail service

I need to relay mail to MTA Server[Mail Server]
Anyway no start sendmail service

How?

1. Make sure OS can resolve DNS

# dig google.com a
-- FOUND RESULT--

Or use "nslookup"
# nslookup google.com
-- FOUND RESULT--

If can not resolve DNS, try to check "/etc/resolv.conf" file ("root" user)

Example:
nameserver dns.server.com

and TEST
.
.
.

2. Edit submit.cf file ("root" user)

Assume: Mail server = mail.server.com
Go to /etc/mail PATH and edit submit.cf file

D{MTAHost}[127.0.0.1]

Edit to ->

D{MTAHost}[mail.server.com]

and stop sendmail service:
# /etc/init.d/sendmail stop

and then check:

# netstat -an | grep 25
--NOT FOUND--
# ps -aef | grep sendmail
--NOT FOUND--

3. Test

# echo "TEST" | sendmail email@domain

# cat /var/log/maillog

Jun 30 00:50:37 hostname sendmail[14352]: m5THobfw014352: from=root, size=5, class=0, nrcpts=1, msgid=<200806291750.m5thobfw014352@hostname>, relay=root@localhost

Jun 30 00:50:38 hostname sendmail[14352]: m5THobfw014352: to=email@domain, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30005, relay=[mail.server.com] [mail.server.com], dsn=2.0.0, stat=Sent (m5THok2L014587 Message accepted for delivery)

...

No comments: