Yet another victim of sendmail/masquerade
I have been spending a day and a half reading all the threads I could find about the topic (and there's a lot of them). Yet I could never find the answer to my problem.
So here it is:
I have a mail server behind a gateway.
Postfix is configured and running, but for some reason, when procmail is invoked for some email copy/forwarding, it calls /usr/sbin/sendmail
This wouldn't be a very big deal if sendmail was using the right domain.
Instead of sending copies of our emails from user@domain, it sends them from firstname.lastname@example.org, which leads in most cases to our forwarded emails as spam by the final mailbox.
This sets the context of my story.
Now to the heart of the problem.
The idea is, we don't use the sendmail service (which is down), just the command /usr/sbin/sendmail
using the command /bin/mail gives the same result.
I was trying to force sendmail to replace localhostname.domain by domain using masquerade.
Here is the relevant part of my sendmail.mc:
next is the command line rule test which works:
So it seems it is up and ready to work until we try this (I remove the server answers as what is sent only is relevant):
/try esmtp email@example.com
final returns: user@domain
Rcode = 0, addr = user@domain
Here, obviously, the disappointment comes from the RCPT TO command which is sent with the address including localhostname, when we tried so hard to only get domain.
/usr/sbin/sendmail -v someaddress@somedomain
>>> EHLO localhostname.domain
>>> MAIL From:<firstname.lastname@example.org> size=***
>>> RCPT To:<someaddress@somedomain>
I could get the EHLO command to be sent with domain only by making modifications to submit.mc and doing a make, but could not find why is the RCPT TO command still using the localhostname.
This is as far as I could get and I am now really running out of ideas.
I ran my test as a non-root user, so this is not the problem.
If anyone has had a similar experience, please do not hesitate to share your knowledge.