0

I have an old mail server that I recently replaced.

The replacement is delivering mail as expected, but there is an odd quirk. I have a variety of aliases that deliver mail to a list of people. When user@example.com sends an e-mail via Outlook to list@example.com, there is a mapping for that Mail-User to an external address called list@mail.example.com, so the To: gets rewritten and delivered to our mail server. When newserver.example.com gets the message, it accepts it and delivers it, but rewrites the To: header to list@newserver.example.com.

The issue with this is that it breaks the reply-to because it expects @example.com and @mail.example.com. How can I prevent this from happening? I have a CNAME record in place that mail.example.com points to newserver.example.com, which makes me think it is mapping it from DNS somehow. Can I prevent this, or at least force it to use mail.example.com or example.com instead of newserver?

Example of the sendmail -bt -- /try esmtp test:

> /try esmtp list@mail.example.com
Trying envelope recipient address list@mail.example.com for mailer esmtp
canonify           input: list @ mail . example . com
Canonify2          input: list < @ mail . example . com >
Canonify2        returns: list < @ newserver . example . com . >
canonify         returns: list < @ newserver . example . com . >
2                  input: list < @ newserver . example . com . >
2                returns: list < @ newserver . example . com . >
EnvToSMTP          input: list < @ newserver . example . com . >
PseudoToReal       input: list < @ newserver . example . com . >
PseudoToReal     returns: list < @ newserver . example . com . >
MasqSMTP           input: list < @ newserver . example . com . >
MasqSMTP         returns: list < @ newserver . example . com . >
EnvToSMTP        returns: list < @ newserver . example . com . >
final              input: list < @ newserver . example . com . >
final            returns: list @ newserver . exemple . com
Rcode = 0, addr = list@newserver.example.com
  • Just discovered FEATURE(`nocanonify') but this partially solves it, but now messages to e.g list@oldserver.domain.com won't get written to list@domain.com (I would like to retain mail.domain.com somehow, or remap specific domains to mail.domain.com) – papashou Nov 3 '15 at 19:37
  • Maybe turn on masquerading so that newserver rewrites newserver.domain.com to mail.domain.com (or domain.com) on outgoing mail. – Mark Plotnick Nov 3 '15 at 19:55
  • masquerading is enabled, but doesn't seem to be working. It looks like it is canonifying mail to newserver because of the CNAME but I can't be sure. Should newserver be a CNAME to mail instead? – papashou Nov 3 '15 at 21:10
  • It's possible. sendmail will canonicalize to $j, which IIRC defaults to whatever the local system reports as its hostname (normally a fully-qualified domain name). It may call gethostbyname to get the canonical name. It's probably better to manually set j in the cf file (probably there's a macro for this) to ensure the name you want rather than rely on CNAMEs. – Mark Plotnick Nov 3 '15 at 21:22
  • Is there a way to properly set $j? – papashou Nov 3 '15 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.