Netlify Mailgun integration not working in Production

  • Netlify site name.
  • DNS custom URL:
  • DNS custom OLD URL:

Weird issue I’m running into. I believe my lambda-function is using an old domain URL to make a call, and it’s failing silently? I recently changed public URLs and updated all environment variables accordingly.

I have a lambda function that triggers a Netlfify email integration (as documented here). My front-end form makes a POST request to my send-email function and that makes a fetch request to the mail template document with necessary parameters.

This action works locally with netlify dev but does not work in production. I see logging in send-email function logs, but in production I:

  • Never get the e-mail
  • Don’t see any logs in Mailgun for the requests

I have checked all environment variables to see if I missed something, and can’t locate any culprits but here’s my logs when I make a POST request to

May 30, 10:25:19 AM: bc3d0e77 INFO   Sending email to ***
May 30, 10:25:20 AM: bc3d0e77 Duration: 37.15 ms	Memory Usage: 64 MB	Init Duration: 305.23 ms	

which calls the system emails function

May 30, 10:19:26 AM: 644ee13f INFO   Email handler received email request from path
May 30, 10:19:26 AM: 644ee13f Duration: 1883.32 ms	Memory Usage: 60 MB	Init Duration: 196.25 ms	

You’ll notice that the email handler URL is the OLD domain URL and not the current one. What the heck is happening?

Does this happen on a freshly created site?