Mailgun throws 401 error [Solved]

It is likely because you need to explicitly whitelist your server’s IP address with Mailgun via the IP Allowlist.