I have sendmail installed on a server running Ubuntu 10.04. I need to be able to send email to my companies email server from this machine, but I am not currently able to. A rep in the IP department determined that my issue was that the IP address my server is resolving for the company mail server is it's external address and I need to be connecting to it's internal address (due to the way they have routing rules configured). He gave me the IP address I need to connect to and instructed me to set mail.mycompany.com to resolve to this IP address. How do I accomplish this? (I tried /etc/hosts but found out very quickly that does not work for sendmail).
You can check what the resolver is giving for the mail server is to use the command
getent hosts mail.example.com
using your mail server in place of mail.example.com. If this isn't giving the right result sendmail won't either. Also try the commandhost -a example.com
to see what mail sever address you are getting from DNS. It should return the internal mail server.It may also be possible the external IP is hard-coded into the sendmail configuration. Check the configuration file for the external address of the mail server. If I remember right it should
/etc/sendmail.conf
.Verify your changes to
/etc/hosts
to do this. Check that the hosts line in/etc/nsswitch.conf
has files listed before DNS. Restartnscd
after making changes to/etc/hosts
. Then rerun the genent command above. The hosts line should read like:Is there any reason you are using sendmail rather than postfix or exim?