# Support for Mailgun via API

**URL:** <https://forum.mautic.org/t/support-for-mailgun-via-api/3374>\
**Category:** 3rd Party Addons\
**Created:** [February 2, 2016, 2:28am UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374 "2016-02-02T02:28:43Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![Zawro](https://avatars.discourse-cdn.com/v4/letter/z/e8c25b/32.png) [@Zawro](https://forum.mautic.org/u/Zawro)\
**Post date:** [May 18, 2017, 2:03am UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/21 "2017-05-18T02:03:00Z")

</div>

My Zawro link is removed. Good luck everyone.

---

<div class="post-metadata">

**Author:** ![hanselke](https://avatars.discourse-cdn.com/v4/letter/h/2acd7d/32.png) [@hanselke](https://forum.mautic.org/u/hanselke)\
**Post date:** [May 22, 2017, 1:07am UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/22 "2017-05-22T01:07:22Z")

</div>

@vln104 Sorry do you think you could post more detailed instructions?

Not sure what i should be doing with /plugins/mailgun/ \<- do i point this to some file inside your bundle?

---

<div class="post-metadata">

**Author:** ![critor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/critor/32/124_2.png) [@critor](https://forum.mautic.org/u/critor)\
**Post date:** [June 15, 2017, 12:31pm UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/23 "2017-06-15T12:31:49Z")

</div>

I just tried this solution and got the attached error when i pressed the test webhook button on mailgun  
any ideas what went wrong.

[https://www.dropbox.com/s/h40cjs46kb4laab/Plugin-Mailgun%20error.txt?dl=0](https://www.dropbox.com/s/h40cjs46kb4laab/Plugin-Mailgun%20error.txt?dl=0)

the location of the mailgun webhook on mautic is  
public\_html/plugins/MailgunReceiverBundle

---

<div class="post-metadata">

**Author:** ![RandomUser](https://avatars.discourse-cdn.com/v4/letter/r/958977/32.png) [@RandomUser](https://forum.mautic.org/u/RandomUser)\
**Post date:** [September 15, 2017, 12:25pm UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/24 "2017-09-15T12:25:00Z")

</div>

Any news about this?  
The plugin from @vln104 seems to be outdated with the latest mautic release.  
Here is what shows up in the error logs:

```auto
Uncaught PHP Exception InvalidArgumentException: "plugin.mailgunReceiver.mailgun is not a valid model key."
```

Here is the problematic line:

```auto
$model = $this-&gt;factory-&gt;getModel('plugin.mailgunReceiver.mailgun');
```

`getModel()` expects two arguments, so I tried something like:

```auto
$model = $this-&gt;factory-&gt;getModel('mailgunReceiver.mailgun');
```

But then here is what shows up in the error logs:

```auto
Uncaught PHP Exception InvalidArgumentException: "mautic.mailgunReceiver.model.mailgun is not a registered container key."
```

I know it has something to do with the registration of a container key, but I have no idea on how to do this as I’m new and not familiar with the code. Can someone provide a working example?  
Thanks.

EDIT: spent all the day reading the docs and trying…still nothing but I added this in the config.php file:

`'services' =&gt; array(
			'models' =&gt; array(
				'mailgunreceiver.mailgun' =&gt; array(
					'class' =&gt; MauticPluginMailgunReceiverBundleModelMailgunModel::class
				)
			)
	)`  
And now I have no erros inside the logs, but the webhook test shows the usual “huh oh” page…Do I have to do something else? Please help!

---

<div class="post-metadata">

**Author:** ![Robov](https://avatars.discourse-cdn.com/v4/letter/r/9dc877/32.png) [@Robov](https://forum.mautic.org/u/Robov)\
**Post date:** [February 3, 2018, 9:28am UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/25 "2018-02-03T09:28:17Z")

</div>

yes to smtp works, but the api calls are much faster, so an integration of their api would be awesome

---

<div class="post-metadata">

**Author:** ![vln104](https://avatars.discourse-cdn.com/v4/letter/v/5f9b8f/32.png) [@vln104](https://forum.mautic.org/u/vln104)\
**Post date:** [February 3, 2018, 12:29pm UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/26 "2018-02-03T12:29:19Z")

</div>

Hi everyone,

I originally made this plugin for an early version of Mautic. I think the plugin structure has moved on from then and I haven’t had the opportunity to update it or follow Mautic’s development.

Once again, apologise for the lack of communications.

I will try to delete this thread to save confusing everyone.

---

<div class="post-metadata">

**Author:** ![altendorfme](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/altendorfme/32/268_2.png) [@altendorfme](https://forum.mautic.org/u/altendorfme)\
**Post date:** [February 7, 2018, 7:38am UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/27 "2018-02-07T07:38:02Z")

</div>

Hi,

Release the source code in Github/Gitlab for the community to continue development.

---

<div class="post-metadata">

**Author:** ![neoroot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/neoroot/32/12641_2.png) [@neoroot](https://forum.mautic.org/u/neoroot)\
**Post date:** [February 9, 2018, 5:10pm UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/28 "2018-02-09T17:10:57Z")

</div>

Hi @vln104 you have a version of your plugin ?  
can we upgrade ? share ? etc ? this plugin

Actually using Mautic v2.12.1

---

<div class="post-metadata">

**Author:** ![critor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/critor/32/124_2.png) [@critor](https://forum.mautic.org/u/critor)\
**Post date:** [March 20, 2018, 12:39pm UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/29 "2018-03-20T12:39:47Z")

</div>

Is there an update on this yet.  
Not having Mailgun API function is a game changer for my company.  
If we dont get an API soon I will have to move to another marketing tool that does, and that would be a shame as i have gotten used to Mautic.

Could someone please find/write an API for Mailgun to Mautic. PLEASSE!

---

<div class="post-metadata">

**Author:** ![Wise-Gorilla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/wise-gorilla/32/444_2.png) [@Wise-Gorilla](https://forum.mautic.org/u/Wise-Gorilla)\
**Post date:** [August 25, 2020, 12:17pm UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/30 "2020-08-25T12:17:19Z")

</div>

I was wondering if you have a specific reasons for not using SES API instead

---

<div class="post-metadata">

**Author:** ![imihandstand](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/imihandstand/32/1499_2.png) [@imihandstand](https://forum.mautic.org/u/imihandstand)\
**Post date:** [April 26, 2021, 8:34am UTC](https://forum.mautic.org/t/support-for-mailgun-via-api/3374/31 "2021-04-26T08:34:25Z")

</div>

Tip: For handling Mailgun’s **“Spam Complaints”** and **“Permanent Failure”** , I use **Integromat** (automatization, like Zapier).  
Mailgun’s webhook fires the “scenario” in Integromat and than that spam/failed contact gets deleted from Mautic.  
You can use of course Mailgun’s other webooks, like **“Temporary Failure”** , **“Unsubscribes”** , etc.

[Previous page](https://forum.mautic.org/t/support-for-mailgun-via-api/3374.md?page=1)
