Well this is my problem .
I have one Centos Server and I want to forward root mail to 1 external account: email@example.com
I installed sendmail and created /root/.forward with this content:
and I sent a test mail with this command:
/usr/sbin/sendmail root <prueba.txt
But nothing was forwarded.
After that I ran the same command with the verbose option:
/usr/sbin/sendmail -v root <prueba.txt
And this is the output:
root... Connecting to [127.0.0.1] via relay...
220 localhost.localdomain ESMTP Sendmail 8.13.8/8.13.8; Wed, 3 Nov 2010 21:09:39 -0600
>>> EHLO localhost.localdomain
250-localhost.localdomain Hello myfriend [127.0.0.1], pleased to meet you
250-AUTH DIGEST-MD5 CRAM-MD5
>>> MAIL From:<firstname.lastname@example.org> SIZE=109 AUTHemail@example.com
250 2.1.0 <firstname.lastname@example.org>... Sender ok
>>> RCPT To:<email@example.com>
250 2.1.5 <firstname.lastname@example.org>... Recipient ok
354 Enter mail, end with "." on a line by itself
250 2.0.0 oA439d8W005554 Message accepted for delivery
root... Sent (oA439d8W005554 Message accepted for delivery)
Closing connection to [127.0.0.1]
221 2.0.0 localhost.localdomain closing connection
This means that sendmail is accepting my mail and queuing it for delivering.
This message is being written in my /var/log/maillog when sendmail try to forward root email:
Nov 3 21:23:25 server sendmail: oA43LMIw006126: email@example.com, ctladdr=<firstname.lastname@example.org> (500/501), delay=00:02:03, xdelay=00:02:02, mailer=esmtp, pri=30593, relay=example.com. [18.104.22.168], dsn=4.0.0, stat=Deferred: Connection timed out with example.com.
For some reason sendmail tried to connect to example.com smtp server and couldn't reach it.
I am sure this is because the smtp server for example.com domain is not example.com is mail.example.com. Besides mail.example.com requires authentication, username , password and the smtp port is not the default 25 is 9999.
May you help me to configure sendmail to forward root mail to a smtp server that requires authentication, username, password with a not the default 25 port?
Thanks in advance