0

I have a server running Sendmail and is able to email to all domains except my company's email (company1.com). I have tested to sending to gmail and other email providers with no issues. Sendmail is configured to use a 3rd party SMTP relay service called MailJet.

When sending to company1.com the SMTP relay does not receive the emails and the error log for sendmail is as follows.

company1 sendmail[676194]: 396L7G6I676194: from= [email protected], size=90, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
company1 sendmail[676196]: 396L7GsW676196: <[email protected]>... User unknown
company1 sendmail[676194]: 396L7G6I676194: [email protected], delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30090, relay=[127.0.0.1] [127.0.0.1], dsn=5.1.1, stat=User unknown

When sending an email to gmail this is the logs.

company1 sendmail[668643]: 396KrnqT668643: from= [email protected], size=95, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
company1 sendmail[668645]: 396KrnVI668645: from=<[email protected]>, size=337, class=0, nrcpts=1, msgid=<[email protected]>, proto=ESMTP, daemon=MTA, relay=company1.com [127.0.0.1]
company1 sendmail[668643]: 396KrnqT668643: [email protected], delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30095, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (396KrnVI668645 Message accepted for delivery)
company1 sendmail[668647]: STARTTLS=client, relay=[104.199.96.85]., version=TLSv1.3, verify=OK, cipher=TLS_AES_256_GCM_SHA384, bits=256/256
company1 sendmail[668647]: 396KrnVI668645: to=<[email protected]>, delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=120337, relay=[104.199.96.85]. [104.199.96.85], dsn=2.0.0, stat=Sent (OK queued as 319dec48-ebc6-4f7d-a470-2c54a4091ac2)

My domain had the following records for DMARC. I have since removed it and it still does not work.

v=DMARC1; p=quarantine; fo=1; pct=100; [email protected]; [email protected]

I have followed steps where people mentioned to modify the /etc/mail/sendmail.mc and add these lines at the end:

define(`MAIL_HUB', `company1.com.')dnl
define(`LOCAL_RELAY', `company1.com.')dnl

This still does not fix it. As far as I can tell sendmail is trying to use itself as a relay when emailing company1.com instead of going through the 3rd party smtp relay server (Mailjet). How can I fix this and get it to work?

4
  • stat=User unknown - it seems that the recipient is unknown to the destination server.
    – joeqwerty
    Commented Oct 8, 2023 at 20:23
  • The user is unknown because the server running sendmail doesn't have any mailboxes/users. It is an asterisk box that needs to send all voicemails to my 3rd party SMTP relay service however it keeps trying to relay to itself. Commented Oct 8, 2023 at 21:33
  • 1
    This appears to relate to incoming email - so why are you telling about a mail relay? Does mailjet also provide the public MX? Why did you try to tell the mail server it was its own relay? What has DMARC got to do with your mailboxes? The ONLY significant (and relevant) information in this post is dsn=5.1.1, stat=User unknown and you've not addressed this at all.
    – symcbean
    Commented Oct 8, 2023 at 23:01
  • The mail server that the mailboxes are on is Office 365. All emails to it works except coming from the server running sendmail because sendmail is trying to look for the mailboxes locally. tsc_chazz perfectly described what is happening Commented Oct 9, 2023 at 16:48

2 Answers 2

1

By default, sendmail running on a system in the domain company1.com will assume that it is the email server for that domain and will forward mail destined for that domain to itself, as you have discovered. I believe the feature you want is the mailertable; enable that in your sendmail configuration, then include an entry in /etc/mail/mailertable of the form

.company1.com:  smtp:mx.mailjet.com

where what follows the "smtp" is one of the mailers for your forwarding service. More detail here: https://www.sendmail.org/~ca/email/doc8.12/cf/m4/mailertables.html

Edit: because Sendmail's features require a backtick to open the quote, I can't show the feature syntax in a comment. Enabling mailertable in the M4 file is done with

FEATURE(`mailertable')dnl

Once you've created the mailertable you also have to turn it into a form that Sendmail can use with something like

makemap hash /etc/mail/mailertable < /etc/mail/mailertable
4
  • I modified /etc/mail/mailertable and added the following .company1.com: smtp:in-v3.mailjet.com It still did not work after restarting sendmail. I even tested .company1.com: esmtp:mx.mailjet.com Commented Oct 9, 2023 at 16:46
  • You also have to enable mailertable in your sendmail configuration. Have you done that?
    – tsc_chazz
    Commented Oct 9, 2023 at 17:01
  • Yes the mailertable has been enabled and I've created the mailertable. Commented Oct 9, 2023 at 17:26
  • It looks like, in this case, it won't work because Mailjet wants username and password for SMTP authentication, before it will allow relay, and Sendmail does not seem to support that in a forwarder - or if it does, I'm unsure how to establish that. You mentioned that your company mailboxes are on Office 365; can you instead direct these mails direct to your company mailboxes there?
    – tsc_chazz
    Commented Oct 9, 2023 at 17:37
0

It turns out the server hostname was set to company1.com which was causing sendmail to force relay to itself. Changing the hostname to server.company1.com fixed the issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .