dropping the hostname in sendmail
February 5, 2008 3:25 PM   RSS feed for this thread Subscribe

I need to change sendmail from sending emails from individual machines as user@host.domain.com to user@domain.com.

any time I try and use unix mail ( among other things), and try and send an email, it always gets rejected as no host on this domain. I am NATed, so my internal DNS is fine for the local network, but all my machines are obviously aren't seen by the dns that my mail server in the ISP has.

This is on RHEL5 boxes. I had the same issue on osx, but It seems that they run postfix by default, vs sendmail on linux. This was a relatively easy fix in postfix, but so far, I haven't figured out sendmail after much googling.

On top of fixing this issue in the short term, Is this the correct way to handle this? Or is there some DNS fix that I am missing on my local network?

I would rather get sendmail working vs. installing postfix and disabling sendmail.
posted by brent_h to computers & internet (6 comments total) 1 user marked this as a favorite
This is called "masquerading". You probably want something like

MASQUERADE_AS(`domain.com')dnl

in /etc/mail/sendmail.mc, then to run a 'make' in /etc/mail to rebuild sendmail.cf. Then restart sendmail.

For more info
posted by 5MeoCMP at 3:40 PM on February 5, 2008


Read up on setting up masquerading in your sendmail.cf.
posted by Blazecock Pileon at 3:40 PM on February 5, 2008


To correct Blazecock Pileon, that's sendmail.mc, not sendmail.cf. You don't want to edit sendmail.cf.

Trust me on that.
posted by eriko at 6:09 PM on February 5, 2008


No, you don't want to edit sendmail.cf if you can avoid it, but you do need masquerading set up in your sendmail.cf, which is explained in the link to Sendmail's site.
posted by Blazecock Pileon at 8:48 PM on February 5, 2008


hey guys, thanks for your responses.

So far no love. I added in the MASQUERADE_AS, ran make, and then restarted the service. and I am still getting the issue. I verified that the changes were getting into the cf file also.

I tried some other options, from here, and they are not working either.

It seems that it is only to emails from my domain, because when I send to gmail or somewhere else it works.

The error I am getting is this;
Domain of sender address root@myMachine.mydomain.com does not exist

Shouldn't the root@myMachine.mydomain.com be what is masqueraded to root@mydomain.com?
Here is the full output, run as root;

sendmail -Am -v -t <>>> EHLO myMachine.mydomain.com
250-mydomain.com Hello rr.com [ip], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE
250-DSN
250-ETRN
250-AUTH PLAIN LOGIN
250-DELIVERBY
250 HELP
>>> MAIL From: SIZE=44
250 2.1.0 ... Sender ok
>>> RCPT To:
>>> DATA
553 5.1.8 ... Domain of sender address root@myMachine.mydomain.com does not exist
503 5.0.0 Need RCPT (recipient)
>>> RSET
250 2.0.0 Reset state
/root/dead.letter... Saved message in /root/dead.letter
Closing connection to mail.mydomain.com.
>>> QUIT
221 2.0.0 mydomain.com closing connection

posted by brent_h at 4:34 PM on February 6, 2008


looks like the issue was because I was running the mail command from root, which when root is the Exposed user, will not masquerade. When I commented out "EXPOSED user" it worked as root. I turned that back on, and will use it from another user.

thanks all.
posted by brent_h at 5:58 PM on February 6, 2008


« Older I've noticed that nearly all o...   |   What's the name of the history... Newer »
This thread is closed to new comments.