Skip to content

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

Open

Description

@henrypenny

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.

Activity

  1. Nyholm commented on Jun 1, 2017

    @Nyholm
    Collaborator

    What version are you running?

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

  2. henrypenny commented on Jun 1, 2017

    @henrypenny
    Author

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions