you can find the script here: https://gist.github.com/silsha/11b1eec219c0afdbca8ec2e242592418
Note that we are using sendgrid for sending mails. I’m sure it would also be possible to send the mails directly via mautic.
Also, this only works for exactly one form (the one you specify in line 27). You also have to find the form field IDs (Line 33-36). The easiest way to do that is inspecting the field in the form editor. You should find IDs like „mauticform_148“.
In mautic you have to set up the webhook by clicking the cog in the upper-right corner → Webhooks → New. Here you have to select the Form Submit Event and enter the url to webhook.php (https://example.com/webhook.php).
Hope that helps. Some PHP knowledge will be needed to get this running. Please let me know if you have any questions.