swiftmailer-mailgun-bundle icon indicating copy to clipboard operation
swiftmailer-mailgun-bundle copied to clipboard

Had to use substantially different config to get this bundle working.

Open henrypenny opened this issue 7 years ago • 2 comments

Here's the config I needed to get this working:

Using Guzzle5 adaptor.

swiftmailer:
    transport: %mailer_transport%
    spool:     { type: memory }

cspoo_swiftmailer_mailgun:
    key: "%mailer_mailgun_key%"
    domain: "%mailer_mailgun_domain%"

services:
    mailgun.library:
        class: Mailgun\Mailgun
        public: true
        arguments: ["%mailer_mailgun_key%", '@guzzle5.adpater']
        calls:
          - ['setApiVersion', ['v3']]

    guzzle5.adpater:
        class: 'Http\Adapter\Guzzle5\Client'
        arguments: ['@guzzle5.client']

    guzzle5.client:
        class: GuzzleHttp\Client
        arguments: [{'base_url':'https://api.mailgun.net', {'defaults' : {'auth' : ['api', '%mailer_mailgun_key%']}}}]

This is quite different to the docs, so I'm wondering where I went wrong.

henrypenny avatar Jun 01 '17 04:06 henrypenny

What version are you running?

You should not be required to configure the guzzle client like that.

Nyholm avatar Jun 01 '17 05:06 Nyholm

From composer.lock:


            "name": "cspoo/swiftmailer-mailgun-bundle",
            "version": "0.3.1",
...
            "name": "mailgun/mailgun-php",
            "version": "v2.3.2",
...
            "name": "php-http/guzzle5-adapter",
            "version": "v1.0.0",

I have had swiftmailer-mailgun-bundle working for several years. I recently had to upgrade from symfony 2.7 to 2.8 and that's when everything stopped working.

Previously I had in my lockfile:

            "name": "cspoo/swiftmailer-mailgun-bundle",
            "version": "dev-master",
...
            "name": "mailgun/mailgun-php",
            "version": "v1.8",

No php-http or guzzle adapters.

It definitely didn't work with the setup in your docs. I have no idea if there's something else weird in my codebase though.

I also noticed that different client providers seemed to require different mailer_mailgun_domain formats.

Sometimes:

    mailer_mailgun_domain: 'acme.com'

Sometimes:

    mailer_mailgun_domain: 'https://api.mailgun.com/v3/acme.com'

I'm not sure about that - I'm using the 'acme.com' form right now.

Unfortunately I have no more time to investigate this further, but I'm posting this in the hope it is of some use to you or helps someone else in a bind.

henrypenny avatar Jun 01 '17 21:06 henrypenny