Git Product home page Git Product logo

swiftmailer-mailgun-bundle's Introduction

Swiftmailer Mailgun bundle

Latest Stable Version codecov.io Total Downloads Monthly Downloads Software License

This bundle adds an extra transport to the swiftmailer service that uses the mailgun http interface for sending messages.

Installation

composer require cspoo/swiftmailer-mailgun-bundle php-http/guzzle5-adapter

Note: You can use any of these adapters

Configuration

Symfony 3.4

Also add to your AppKernel:

new cspoo\Swiftmailer\MailgunBundle\cspooSwiftmailerMailgunBundle(),

Configure your application with the credentials you find on the domain overview on the Mailgun.com dashboard.

// app/config/config.yml:
cspoo_swiftmailer_mailgun:
    key: "key-xxxxxxxxxx"
    domain: "mydomain.com"
    endpoint: "https://api.eu.mailgun.net" # Optional. Use this config for EU region. Defaults to "https://api.mailgun.net"
    http_client: "httplug.client" # Optional. Defaults to null and uses discovery to find client. 

# Swiftmailer Configuration
swiftmailer:
    transport: "mailgun"
    spool:     { type: memory } # This will start sending emails on kernel.terminate event

Note that the swiftmailer configuration is the same as the standard one - you just change the mailer_transport parameter.

Symfony 4.1

Add your Mailgun credentials

# both .env and .env.dist files
MAILGUN_DOMAIN=<your domain>
MAILGUN_API_KEY=<your key>
MAILGUN_SENDER=<your sender>

Adding to you bundle

// config/bundles.php
return [
    ...
    cspoo\Swiftmailer\MailgunBundle\cspooSwiftmailerMailgunBundle::class => ['all' => true],
    ];

Configure your Mailgun credentials:

// config/packages/mailgun.yaml
cspoo_swiftmailer_mailgun:
    key: '%env(MAILGUN_API_KEY)%'
    domain: "%env(MAILGUN_DOMAIN)%"

services:
    Mailgun\Mailgun:
        class: Mailgun\Mailgun
        factory: ['Mailgun\Mailgun', create]
        arguments: ['%env(MAILGUN_API_KEY)%']

Finally, add the following line on swiftmailer config:

// config/packages/swiftmailer.yaml
swiftmailer:
    # url: '%env(MAILER_URL)%'
    transport: 'mailgun'
    spool: { type: 'memory' }

Note: Not sure if url line should be commented.

Usage

First craft a message:

$message = \Swift_Message::newInstance()
        ->setSubject('Hello Email')
        ->setFrom('[email protected]')
        ->setTo('[email protected]')
        ->setBody(
            $this->renderView(
                'HelloBundle:Hello:email.txt.twig',
                array('name' => $name)
            )
        )
    ;

Then send it as you normally would with the mailer service. Your configuration ensures that you will be using the Mailgun transport.

$this->container->get('mailer')->send($message);

You can also test through terminal using:

bin/console swiftmailer:email:send --from=<from email> --to=<to email> --subject="Foo" --body="Bar"

Choose HTTP client

Mailgun 2.0 is no longer coupled to Guzzle5. Thanks to Httplug you can now use any library to transport HTTP messages. You can rely on discovery to automatically find an installed client or you can use HttplugBundle and provide a client service name to the mailgun configuration.

// app/config/config.yml:
cspoo_swiftmailer_mailgun:
    http_client: 'httplug.client'

swiftmailer-mailgun-bundle's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftmailer-mailgun-bundle's Issues

Mailgun availability in container

Hi

I'm on symfony 2.8 and I installed mailgun according to the installation instruction on: https://github.com/tehplague/swiftmailer-mailgun-bundle

I trying to use $container->get('mailgun.library') in a self created Symfony command but I'm getting an exception:

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
You have requested a non-existent service "mailgun.library"

Executing these commands php app/console debug:container mailgun and php app/console debug:container mailgun.library also throw the exception:

[InvalidArgumentException]
No services found that match "mailgun".

Any idea what the problem could be?

PS: actually I'm not sure if it is the right place to open this issue.

Implement detailed logging for Mailgun exceptions

As far as I can tell, currently we are limited to the Swift_Events_SendEvent error codes. This means that when Mailgun throws an error, we don't have any indication of what the underlying cause of the underlying error is.

This was a problem for us recently, where we would randomly get sporadic mail delivery failures, but with no way to tell what was causing them since we didn't have access to the Mailgun API response code.

Would you consider an option to allow more detailed logging, specifically the exception message that Mailgun throws when it encounters an error? This should be as simple as a config option for enabling detailed logging, and then injecting the logger service into MailgunTransport.

Request is not send.

I don't know why this bundle stopped working. I don't know what changes I have to make for mailgun 2.0. I'm not receiving any log error, the emails are just not send.

I'm using the dev-master branch and
this dependencies`

    "php": "^5.5|^7.0",
    "guzzlehttp/psr7": "~1.2",
    "php-http/httplug": "^1.0",
    "php-http/discovery": "^0.8"

`
Do I have to update the dependencies?

Edit: I downgraded to v0.2.1 and it worked

cspoo_swiftmailer_mailgun:
    key: "%api_email_key%"
    domain: "mailgun.newtonlabs.com.gt"

# Swiftmailer Configuration
swiftmailer:
    transport: "mailgun"
    spool:     { type: memory }

HTTP client

Can we still use the bundle by installing cspoo/swiftmailer-mailgun-bundle and php-http/guzzle5-adapter or do we have to remove php-http/guzzle5-adapter and use php-http/httplug-bundle?
I'm not getting the doc here.
Thanks!

The child node "key" at path "cspoo_swiftmailer_mailgun" must be configured.

Hi! I installed everything and Im getting this error whenever I want to run a command.

I'm running Symfony 4 and this version of the lib
"name": "cspoo/swiftmailer-mailgun-bundle",
"version": "1.1.0",

$ php bin/console doctrine:schema:update

In ArrayNode.php line 230:

The child node "key" at path "cspoo_swiftmailer_mailgun" must be configured.

I can't configure as it shows in the docs because it changes for Symfony v4, so I tried putting this conf in config/services.yaml, config/packages/mailgun.yaml, I even created a parameters.yaml but with no success.

    cspoo_swiftmailer_mailgun:
        key: "key-f132131313131"
        domain: "sandbox700asdasdasdadasdasdasdadada.mailgun.org"
    swiftmailer:
        transport: "mailgun"

HELP PLEASE!!
Thanks in advance

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

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.

Tag a new version

Hello,

For Symfony4 users, only dev-master is compliant. Can you release a new version of the bundle please ?

httpResponseCode 404

so i use this bundle for my symfony 3 for sending email through mailgun.
I set as usage but i always getting 404 httpResponseCode in RestClient.

swiftmailer.delivery_addresses configuration?

cspoo_swiftmailer_mailgun:
    key    : 'key-somekey'
    domain : 'sandboxsomedomain.mailgun.org'

swiftmailer:
    transport: 'mailgun'
    spool:     { type: memory } # This will start sending emails on kernel.terminate event
    delivery_addresses:
        - '[email protected]'
$mailer  = /* Service '@mailer' from app/config.yml */;
$message = \Swift_Message::newInstance();
$message->setFrom('[email protected]');
$message->setSubject('subj');
$message->setTo('[email protected]');
$message->setBody('some html body', 'text/html', 'utf-8');
$mailer->send($message);

With default transport it works good – sends email to [email protected] (from configuration).

But with mailgun transport it send email to [email protected] which is incorrect.

Is it implemented but i'm using it wrong? Or, if not, how it can be workarounded?

Not compatible with Symfony 4.1

I'm migrating a big app from 3.4 to 4.1 and this packages gives me:

cspoo/swiftmailer-mailgun-bundle dev-master requires symfony/force-lowest ^3 -> satisfiable by symfony/force-lowest[v3.4.0].
    - Conclusion: don't install symfony/symfony v4.1.1

Tried composer update and composer update --with-dependencies

Mailgin version 0.4

16:39:36 CRITICAL [php] Call to a member function createSendEvent() on null ["exception" => Symfony\Component\Debug\Exception\FatalThrowableError { …}] []

In MailgunTransport.php line 93

do you have an idea ?

thanks

Provide support for Symfony Flex

This bundle still depends on symfony/symfony which breaks compatibility with Symfony Flex. We should use dependencies on the respective Symfony Components instead.

ServiceNotFoundException:You have requested a non-existent service "httplug.client".

After some tries we managed to have everything working (locally and in production) smoothly with Symfony version 3.1.10 + swiftmailer + MailgunBundle + httplug-bundle + Guzzle 6 Adapter.
But if we try to make a composer update or composer install then we get this error:
[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] You have requested a non-existent service "httplug.client".

Here is our require statement of the composer.json file:

"require":
{
"php": ">=5.5.9",
"symfony/symfony": "3.1.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"symfony/polyfill-apcu": "^1.0",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"friendsofsymfony/user-bundle": "~2.0@dev",
"hwi/oauth-bundle": "^0.5.1",
"illuminate/database": "^5.4",
"knplabs/knp-paginator-bundle": "^2.5",
"yceruto/breadcrumbs-bundle": "^1.0",
"cspoo/swiftmailer-mailgun-bundle": "0.4.0",
"php-http/guzzle6-adapter": "^1.1.1",
"php-http/httplug-bundle": "^1.6"
},

Here is a part of the conposer.lock generated after a brand new installation:
{
"name": "cspoo/swiftmailer-mailgun-bundle",
"version": "0.4.0",
"source": {
"type": "git",
"url": "https://github.com/tehplague/swiftmailer-mailgun-bundle.git",
"reference": "1d592cc1e7ae011381f2dbbb6892a6c991517f7c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tehplague/swiftmailer-mailgun-bundle/zipball/1d592cc1e7ae011381f2dbbb6892a6c991517f7c",
"reference": "1d592cc1e7ae011381f2dbbb6892a6c991517f7c",
"shasum": ""
},
"require": {
"mailgun/mailgun-php": "^2.3",
"php": "^5.5 || ^7.0",
"swiftmailer/swiftmailer": "^5.0",
"symfony/dependency-injection": "^2.7 || ^3.0"
},
"require-dev": {
"guzzlehttp/psr7": "^1.4",
"matthiasnoback/symfony-dependency-injection-test": "^1.0",
"nyholm/symfony-bundle-test": "^1.0",
"php-http/guzzle6-adapter": "^1.0",
"phpunit/phpunit": "^4.8 || ^5.7",
"symfony/swiftmailer-bundle": "^2.5.1",
"symfony/symfony": "^2.7 || ^3.0"
},
"suggest": {
"azine/mailgunwebhooks-bundle": "Allows to handle Mailgun event webhooks",
"php-http/httplug-bundle": "To manage your http clients"
},
"type": "symfony-bundle",
"autoload": {
"psr-4": {
"cspoo\Swiftmailer\MailgunBundle\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-2.0+"
],
"authors": [
{
"name": "Christian Spoo",
"email": "[email protected]",
"homepage": "http://www.christian-spoo.info/",
"role": "Developer"
}
],
"description": "Swiftmailer Mailgun bundle",
"homepage": "https://github.com/tehplague/swiftmailer-mailgun-bundle",
"keywords": [
"e-mail",
"mailgun",
"swiftmailer"
],
"time": "2017-05-29 10:51:57"
},

And here is a part of the config.yml:

httplug:
plugins:
logger: ~
clients:
acme:
factory: 'httplug.factory.guzzle6'
plugins: ['httplug.plugin.logger']
config:
verify: false
timeout: 2

cspoo_swiftmailer_mailgun:
key: "key-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
domain: "mydomain.net"
http_client: 'httplug.client' # Optional. Defaults to null and uses dicovery to find client.

# Swiftmailer Configuration

swiftmailer:
transport: "mailgun"
spool: { type: memory } # This will start sending emails on kernel.terminate event# Swiftmailer Configuration
#host: "%mailer_host%"
#username: "%mailer_user%"
#password: "%mailer_password%"
#spool: { type: memory }
#encryption: "%mailer_encryption%"

I understand that httplug is installed but somehow cspoo_swiftmailer_mailgun is not able to identify the service. Maybe is just a typo in the config file or maybe the exception raises because a problem with versions and dependencies.
We have been stuck with this problem and I will really appreciate any guidance on how to solve it.

tagging emails + additional parameters for mailgun

hi

it would be useful to be able to use o:tag parameter (and others) when sending email.
https://documentation.mailgun.com/user_manual.html#tagging

there doesn't seems to be a way to set any of the extra parameters outside of sendMessage() function on mailgun class.

it looks like the current implementation is already using headers to parse to and from from message ($toHeader = $message->getHeaders()->get('To');) so maybe other parameters can be parsed from headers as well.
but doing special parsing of each parameter and passing it to mailgun is not future proof

SwiftMailer 6

Hi,
I need to use SwiftMailer ^6.0 in my project but your bundle requires the 5.0 version — is this compatible ? In this case, could you change the requirements for something like ^5.0 || ^6.0 ?

Thanks a lot !

Can't upgrade to 1.2

I was using v0.3.1 from now on (started with a Symfony 2.8 at the time), and now I wanted to upgrade to v1.2, while my Symfony version is 3.4.
But the composer require refuse to do it.
Could you help?

$ composer require cspoo/swiftmailer-mailgun-bundle --update-with-dependencies
Using version ^1.2 for cspoo/swiftmailer-mailgun-bundle
./composer.json has been updated
Dependency "symfony/symfony" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Dependency "symfony/symfony" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: remove swiftmailer/swiftmailer v5.4.12
    - Conclusion: don't install swiftmailer/swiftmailer v6.2.3
    - Conclusion: don't install swiftmailer/swiftmailer v5.4.12
    - Conclusion: don't install swiftmailer/swiftmailer v6.2.2
    - Conclusion: don't install swiftmailer/swiftmailer v5.4.11
    - Conclusion: don't install swiftmailer/swiftmailer v6.2.1
    - Conclusion: don't install swiftmailer/swiftmailer v5.4.10
    - Conclusion: don't install swiftmailer/swiftmailer v6.2.0
    - Conclusion: don't install swiftmailer/swiftmailer v5.4.9
    - Conclusion: don't install swiftmailer/swiftmailer v6.1.3
    - Conclusion: don't install swiftmailer/swiftmailer v5.4.8
    - Conclusion: don't install swiftmailer/swiftmailer v6.1.2
    - Conclusion: don't install swiftmailer/swiftmailer v5.4.7
    - Conclusion: don't install swiftmailer/swiftmailer v6.1.1
    - Conclusion: don't install swiftmailer/swiftmailer v5.4.6
    - Conclusion: don't install swiftmailer/swiftmailer v6.1.0
    - Conclusion: don't install swiftmailer/swiftmailer v5.4.5
    - Conclusion: don't install swiftmailer/swiftmailer v6.0.2
    - Conclusion: don't install swiftmailer/swiftmailer v5.4.4
    - Installation request for cspoo/swiftmailer-mailgun-bundle ^1.2 -> satisfiable by cspoo/swiftmailer-mailgun-bundle[1.2.0].
    - symfony/swiftmailer-bundle v2.6.7 requires swiftmailer/swiftmailer ~4.2|~5.0 -> satisfiable by swiftmailer/swiftmailer[v5.4.12, v4.2.0, v4.2.1, v4.2.2, v4.3.0, v4.3.1, v5.0.0, v5.0.1, v5.0.2, v5.0.3, v5.1.0, v5.2.0, v5.2.1, v
5.2.2, v5.3.0, v5.3.1, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.2, v5.4.3, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9].
    - symfony/swiftmailer-bundle v2.6.7 requires swiftmailer/swiftmailer ~4.2|~5.0 -> satisfiable by swiftmailer/swiftmailer[v5.4.12, v4.2.0, v4.2.1, v4.2.2, v4.3.0, v4.3.1, v5.0.0, v5.0.1, v5.0.2, v5.0.3, v5.1.0, v5.2.0, v5.2.1, v
5.2.2, v5.3.0, v5.3.1, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.2, v5.4.3, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9].
    - symfony/swiftmailer-bundle v2.6.7 requires swiftmailer/swiftmailer ~4.2|~5.0 -> satisfiable by swiftmailer/swiftmailer[v5.4.12, v4.2.0, v4.2.1, v4.2.2, v4.3.0, v4.3.1, v5.0.0, v5.0.1, v5.0.2, v5.0.3, v5.1.0, v5.2.0, v5.2.1, v
5.2.2, v5.3.0, v5.3.1, v5.4.0, v5.4.1, v5.4.10, v5.4.11, v5.4.2, v5.4.3, v5.4.4, v5.4.5, v5.4.6, v5.4.7, v5.4.8, v5.4.9].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.0.0].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.0.1].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.0.2].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.0.3].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.1.0].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.2.0].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.2.1].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.2.2].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.3.0].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.3.1].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.4.0].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.4.1].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.4.2].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.4.3].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v5.4.12].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v4.2.0].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v4.2.1].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v4.2.2].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v4.3.0].
    - Can only install one of: swiftmailer/swiftmailer[v6.0.0, v4.3.1].
    - cspoo/swiftmailer-mailgun-bundle 1.2.0 requires swiftmailer/swiftmailer ^6.0 -> satisfiable by swiftmailer/swiftmailer[v6.0.0, v6.0.1, v6.0.2, v6.1.0, v6.1.1, v6.1.2, v6.1.3, v6.2.0, v6.2.1, v6.2.2, v6.2.3].
    - Conclusion: don't install swiftmailer/swiftmailer v6.0.1
    - Installation request for symfony/swiftmailer-bundle (locked at v2.6.7, required as ~2.3) -> satisfiable by symfony/swiftmailer-bundle[v2.6.7].


Installation failed, reverting ./composer.json to its original content.

If I try to update symfony/swiftmailer-bundle, here is what I get. I'm lost.

$ composer require  symfony/swiftmailer-bundle --update-with-dependencies
Using version ^3.4 for symfony/swiftmailer-bundle
./composer.json has been updated
Dependency "symfony/symfony" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Dependency "symfony/symfony" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Dependency "symfony/symfony" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for symfony/swiftmailer-bundle ^3.4 -> satisfiable by symfony/swiftmailer-bundle[v3.4.0].
    - Conclusion: remove symfony/symfony v3.4.36
    - Conclusion: don't install symfony/symfony v3.4.36
    - symfony/swiftmailer-bundle v3.4.0 requires symfony/http-kernel ^4.3.8|^5.0 -> satisfiable by symfony/http-kernel[v4.3.8, v4.3.9, v4.4.0, v4.4.1, v5.0.0, v5.0.1].
    - don't install symfony/http-kernel v4.3.8|don't install symfony/symfony v3.4.36
    - don't install symfony/http-kernel v4.3.9|don't install symfony/symfony v3.4.36
    - don't install symfony/http-kernel v4.4.0|don't install symfony/symfony v3.4.36
    - don't install symfony/http-kernel v4.4.1|don't install symfony/symfony v3.4.36
    - don't install symfony/http-kernel v5.0.0|don't install symfony/symfony v3.4.36
    - don't install symfony/http-kernel v5.0.1|don't install symfony/symfony v3.4.36
    - Installation request for symfony/symfony (locked at v3.4.36, required as 3.4.*) -> satisfiable by symfony/symfony[v3.4.36].


Installation failed, reverting ./composer.json to its original content.

Not compatible with Symfony4

To be more precise, i can't install it in a symfony 4 project because it conflicts with symfony/dependency-injection:

Problem 1
    - cspoo/swiftmailer-mailgun-bundle 1.0.0 requires symfony/dependency-injection ^2.7 || ^3.0 -> satisfiable by symfony/dependency-injection[2.7.x-dev, 2.8.x-dev, 3.0.x-dev, 3.1.x-dev, 3.2.x-dev, 3.3.x-dev, 3.4.x-dev, v2.7.0, v2.7.0-BETA1, v2.7.0-BETA2, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.23, v2.7.24, v2.7.25, v2.7.26, v2.7.27, v2.7.28, v2.7.29, v2.7.3, v2.7.30, v2.7.31, v2.7.32, v2.7.33, v2.7.34, v2.7.35, v2.7.36, v2.7.37, v2.7.38, v2.7.39, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.0-BETA1, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.16, v2.8.17, v2.8.18, v2.8.19, v2.8.2, v2.8.20, v2.8.21, v2.8.22, v2.8.23, v2.8.24, v2.8.25, v2.8.26, v2.8.27, v2.8.28, v2.8.29, v2.8.3, v2.8.30, v2.8.31, v2.8.32, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9, v3.0.0, v3.0.0-BETA1, v3.0.1, v3.0.2, v3.0.3, v3.0.4, v3.0.5, v3.0.6, v3.0.7, v3.0.8, v3.0.9, v3.1.0, v3.1.0-BETA1, v3.1.0-RC1, v3.1.1, v3.1.10, v3.1.2, v3.1.3, v3.1.4, v3.1.5, v3.1.6, v3.1.7, v3.1.8, v3.1.9, v3.2.0, v3.2.0-BETA1, v3.2.0-RC1, v3.2.0-RC2, v3.2.1, v3.2.10, v3.2.11, v3.2.12, v3.2.13, v3.2.14, v3.2.2, v3.2.3, v3.2.4, v3.2.5, v3.2.6, v3.2.7, v3.2.8, v3.2.9, v3.3.0, v3.3.0-BETA1, v3.3.0-RC1, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.0-BETA1, v3.4.0-BETA2, v3.4.0-BETA3, v3.4.0-BETA4, v3.4.0-RC1, v3.4.0-RC2, v3.4.1, v3.4.2] but these conflict with your requirements or minimum-stability.

can't use guzzle

With a very basic symfony app (based on the Symfony4.2 demo, all started plugins), I'm having difficult configuring the bundle.

I can install it, but can't install an adapter. The problem is httplug version, needs to allow version 2.

In HttpClientDiscovery.php line 27:
                                                                                                                                             
  No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation". Example: "php-http/guzzle6-adapter".  
                                                                                                                                             

In DiscoveryFailedException.php line 41:
                                                                                                                                                                                                                                                           
  Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors                                                                                                           
   - Puli Factory is not available                                                                                                                                                                                                                         
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonClassesStrategy". We tested the following candidates: Http\Adapter\Guzzle6\Client, Http\Adapter\Guzzle5\Client, Http\Client\Curl\Client, Http\Client\Socket\Client, Http\Adap  
  ter\Buzz\Client, Http\Adapter\React\Client, Http\Adapter\Cake\Client, Http\Adapter\Zend\Client, Http\Adapter\Artax\Client, Http\Discovery\Strategy\CommonClassesStrategy::buzzInstantiate.                                                               
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonPsr17ClassesStrategy". We tested the following candidates: .                                                                                                                   
                                                                                                                                                                                                                                                           

swiftmailer:email:send [--from FROM] [--to TO] [--subject SUBJECT] [--body BODY] [--mailer MAILER] [--content-type CONTENT-TYPE] [--charset CHARSET] [--body-source BODY-SOURCE] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>

tac@wild-dog:~/rappnet$ composer require php-http/guzzle6-adapter
Using version ^2.0 for php-http/guzzle6-adapter
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.2.*"
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install php-http/guzzle6-adapter v2.0.1
    - Conclusion: don't install php-http/guzzle6-adapter v2.0.0
    - Conclusion: remove php-http/httplug v1.1.0
    - Installation request for php-http/guzzle6-adapter ^2.0 -> satisfiable by php-http/guzzle6-adapter[2.x-dev, v2.0.0, v2.0.1].
    - Conclusion: don't install php-http/httplug v1.1.0
    - php-http/guzzle6-adapter 2.x-dev requires php-http/httplug ^2.0 -> satisfiable by php-http/httplug[2.0.x-dev, v2.0.0].
    - Can only install one of: php-http/httplug[2.0.x-dev, v1.1.0].
    - Can only install one of: php-http/httplug[v2.0.0, v1.1.0].
    - Installation request for php-http/httplug (locked at v1.1.0) -> satisfiable by php-http/httplug[v1.1.0].


Installation failed, reverting ./composer.json to its original content.

depends [-r|--recursive] [-t|--tree] [--] <package> [<constraint>]

tac@wild-dog:~/rappnet$ composer why php-http/httplug
mailgun/mailgun-php     2.6.0  requires  php-http/httplug (^1.0)  
php-http/client-common  1.9.0  requires  php-http/httplug (^1.1)  

Issue with Symfony 4.2

I tried to install it with symfony 4.2 but it display me a long list of errors and don't have idea how to fix.

composer require cspoo/swiftmailer-mailgun-bundle php-http/guzzle5-adapter
Using version ^1.2 for cspoo/swiftmailer-mailgun-bundle
Using version ^2.0 for php-http/guzzle5-adapter
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.1.*"
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - php-http/client-common v1.6.0 requires symfony/options-resolver ^2.6 || ^3.0 -> no matching package found.
    - php-http/client-common v1.4.2 requires symfony/options-resolver ^2.6 || ^3.0 -> no matching package found.
    - php-http/client-common v1.4.1 requires symfony/options-resolver ^2.6 || ^3.0 -> no matching package found.
    - php-http/client-common v1.4.0 requires symfony/options-resolver ^2.6 || ^3.0 -> no matching package found.
    - php-http/client-common v1.2.1 requires symfony/options-resolver ^2.6 || ^3.0 -> no matching package found.
    - php-http/client-common v1.2.0 requires symfony/options-resolver ^2.6|^3.0 -> no matching package found.
    - php-http/client-common v1.1.0 requires symfony/options-resolver ^2.6|^3.0 -> no matching package found.
    - php-http/client-common 1.5.0 requires symfony/options-resolver ^2.6 || ^3.0 -> no matching package found.
    - php-http/client-common 1.3.0 requires symfony/options-resolver ^2.6 || ^3.0 -> no matching package found.
    - Installation request for cspoo/swiftmailer-mailgun-bundle ^1.2 -> satisfiable by cspoo/swiftmailer-mailgun-bundle[1.2.0].
    - cspoo/swiftmailer-mailgun-bundle 1.2.0 requires mailgun/mailgun-php ^2.3 -> satisfiable by mailgun/mailgun-php[2.3.4, 2.4.1, 2.5.0, 2.6.0, 2.7.0, 2.8.0, 2.8.1, v2.3.0, v2.3.1, v2.3.2, v2.3.3, v2.4.0].
    - mailgun/mailgun-php 2.8.1 requires php-http/client-common ^1.1 -> satisfiable by php-http/client-common[1.3.0, 1.5.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, v1.1.0, v1.2.0, v1.2.1, v1.4.0, v1.4.1, v1.4.2, v1.6.0].
    - mailgun/mailgun-php 2.8.0 requires php-http/client-common ^1.1 -> satisfiable by php-http/client-common[1.3.0, 1.5.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, v1.1.0, v1.2.0, v1.2.1, v1.4.0, v1.4.1, v1.4.2, v1.6.0].
    - mailgun/mailgun-php 2.7.0 requires php-http/client-common ^1.1 -> satisfiable by php-http/client-common[1.3.0, 1.5.0, 1.7.0, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, v1.1.0, v1.2.0, v1.2.1, v1.4.0, v1.4.1, v1.4.2, v1.6.0].
    - mailgun/mailgun-php 2.3.4 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
    - mailgun/mailgun-php 2.4.1 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
    - mailgun/mailgun-php 2.5.0 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
    - mailgun/mailgun-php 2.6.0 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
    - mailgun/mailgun-php v2.3.0 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
    - mailgun/mailgun-php v2.3.1 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
    - mailgun/mailgun-php v2.3.2 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
    - mailgun/mailgun-php v2.3.3 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
    - mailgun/mailgun-php v2.4.0 requires php-http/httplug ^1.0 -> satisfiable by php-http/httplug[v1.0.0, v1.1.0].
    - php-http/client-common 1.7.0 requires php-http/httplug ^1.1 -> satisfiable by php-http/httplug[v1.1.0].
    - php-http/client-common 1.8.0 requires php-http/httplug ^1.1 -> satisfiable by php-http/httplug[v1.1.0].
    - php-http/client-common 1.8.1 requires php-http/httplug ^1.1 -> satisfiable by php-http/httplug[v1.1.0].
    - php-http/client-common 1.8.2 requires php-http/httplug ^1.1 -> satisfiable by php-http/httplug[v1.1.0].
    - php-http/client-common 1.9.0 requires php-http/httplug ^1.1 -> satisfiable by php-http/httplug[v1.1.0].
    - php-http/client-common 1.9.1 requires php-http/httplug ^1.1 -> satisfiable by php-http/httplug[v1.1.0].
    - Can only install one of: php-http/httplug[v2.0.0, v1.0.0].
    - Can only install one of: php-http/httplug[v2.0.0, v1.1.0].
    - php-http/guzzle5-adapter 2.0.0 requires php-http/httplug ^2.0 -> satisfiable by php-http/httplug[v2.0.0].
    - Installation request for php-http/guzzle5-adapter ^2.0 -> satisfiable by php-http/guzzle5-adapter[2.0.0].

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

Incompatibility with Symfony 4 - Deprecated DefinitionDecorator

I am trying to install and use this bundle in Symfony 4, but I am getting the following error:

PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "DefinitionDecorator" from namespace "Symfony\Component\DependencyInjection".
Did you forget a "use" statement for another namespace? in [...]/cspooSwiftmailerMailgunExtension.php:36

According to the Symfony documentation DefinitionDecorator class has been deprecated since 3.3 and removed in 4.0. This class needs to be replaced by ChildDefinition.

https://github.com/symfony/symfony/blob/master/UPGRADE-4.0.md

I will open a new PR for this issue.

Cheers.

Unrecognized option "http_client" under "mailgun"

After some tries we managed to have everything working (locally and in production) smoothly with Symfony version 3.1.10 + swiftmailer + MailgunBundle + httplug-bundle + Guzzle 6 Adapter.
But if we try to make a composer update or composer install then we get this error:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException] Unrecognized option "http_client" under "mailgun"

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the symfony-scripts event terminated with an exception

[RuntimeException] An error occurred when executing the "'cache:clear --no-warmup'" command:

[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException] Unrecognized option "http_client" under "mailgun"

After checking both installations it is quite clear that there is a huge difference between each composer.lock

Here is a part of the working one:

{
"name": "cspoo/swiftmailer-mailgun-bundle",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/tehplague/swiftmailer-mailgun-bundle.git",
"reference": "21efc86edfa7b5d47fc944a821ee400b9af2f2d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tehplague/swiftmailer-mailgun-bundle/zipball/21efc86edfa7b5d47fc944a821ee400b9af2f2d6",
"reference": "21efc86edfa7b5d47fc944a821ee400b9af2f2d6",
"shasum": ""
},
"require": {
"mailgun/mailgun-php": "^2.0",
"php": "^5.5 || ^7.0",
"swiftmailer/swiftmailer": "^5.0",
"symfony/dependency-injection": "^2.7 || ^3.0"
},

And here is the "equivalent" in the installation that doesn't work:

{
"name": "cspoo/swiftmailer-mailgun-bundle",
"version": "0.2.0",
"target-dir": "cspoo/Swiftmailer/MailgunBundle",
"source": {
"type": "git",
"url": "https://github.com/tehplague/swiftmailer-mailgun-bundle.git",
"reference": "a23acf5fc4410c6abc9843dee82013d5f89a2426"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tehplague/swiftmailer-mailgun-bundle/zipball/a23acf5fc4410c6abc9843dee82013d5f89a2426",
"reference": "a23acf5fc4410c6abc9843dee82013d5f89a2426",
"shasum": ""
},
"require": {
"mailgun/mailgun-php": ">=1.7",
"php": ">=5.3",
"swiftmailer/swiftmailer": "~5.0, >=4.0"
},

And here is the requiere statement of the composer.json:

"require": {
    "php": ">=5.5.9",
    "symfony/symfony": "3.1.*",
    "doctrine/orm": "^2.5",
    "doctrine/doctrine-bundle": "^1.6",
    "doctrine/doctrine-cache-bundle": "^1.2",
    "symfony/swiftmailer-bundle": "^2.3",
    "symfony/monolog-bundle": "^2.8",
    "symfony/polyfill-apcu": "^1.0",
    "sensio/distribution-bundle": "^5.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "^2.0",
    "friendsofsymfony/user-bundle": "~2.0@dev",
    "hwi/oauth-bundle": "^0.5.1",
    "illuminate/database": "^5.4",
    "knplabs/knp-paginator-bundle": "^2.5",
    "yceruto/breadcrumbs-bundle": "^1.0",
    "cspoo/swiftmailer-mailgun-bundle": "dev-master",
    "php-http/guzzle6-adapter": "^1.1",
    "php-http/httplug-bundle": "^1.4"
},

I understand that "cspoo/swiftmailer-mailgun-bundle": "dev-master" requieres the last version in the dev-master branch and it creates an inconsistency between versions and dependencies.
Do you have any clue about how shall we procede to avoid these error and keep our project updated?

Dynamic Domains

Currently Domain is a config parameter but depending your use case you might be managing multiple domains with Mailgun in the same application. To achieve this you would need the domain parameter to be configurable at runtime before the Mail is sent.

Symfony 4 issue MailgunTransporter not set

Hi

I'm on Symfony 4.1 and trying several times to get this bundle working.

My problem is: The Swiftmailer transporter is never set to MailgunTransporter but always SpoolTransporter instead..

Of course I following the steps described in the documentation.

Did anybody else experienced this issue?

Some emails are not processed if we get an exception from mailgun

I'm using the spool: { type: memory } that processes the spool on kernel.terminate event.
The problem I'm having is :
If you have 3 emails in spool but for whatever reason mail#2 throws an exception while attempting to send it, then mail#3 never get processed.

I think a good solution might be to add a try / catch around sendMessage call in MailgunTransport. This silences the exception and that might be bad but it would avoid unprocessed emails. WDYT ?

Bad instantiation of mailgun library

You create instance of Mailgun\Mailgun class through constructor but you need to use Mailgun\Mailgun::configure.
Without that any api call wont work when you get the "mailgun.library" service.

$configurator = new HttpClientConfigurator(); $configurator->setApiKey('key-example'); $mg = Mailgun::configure($configurator, new ArrayHydator()); $data = $mg->domains()->show('example.com');

https://github.com/mailgun/mailgun-php/issues/346

Transport not registered exception

We tried as per documentation and symfony is exploding when trying to send email. It says that the "mailgun" transport is not a default transport.

To make it work we had to add the following service definition:

services:
  # Hijack the transport because of mailgun
  swiftmailer.mailer.default.transport:
    alias: mailgun.swift_transport.transport

Is that expected or something is missing from the documentation?

Attaching custom data to messages

Hey.

I would like to attach custom data to the message as described in Mailgun docs:

http://mg-documentation.readthedocs.io/en/latest/user_manual.html#attaching-data-to-messages

According to the docs:

The data will be represented as a header within the email, X-Mailgun-Variables. To add this header to your message:
API: Pass the following parameter, “v:my-custom-data” => “{“my_message_id”: 123}”.
SMTP: Add the following header to your email, “X-Mailgun-Variables: {“my_message_id”: 123}”.

Is it possible to achieve this with this bundle?

What I have tried is that I added a header to the message (basically used SMTP approach, but bundle is using API). I can see this header in the message:

X-Mailgun-Variables: {“my_message_id”: 123}

However in the mailgun logs user-variables is empty.

"user-variables": {},

Would anyone be able to advise on this please?

Thank you.

Add a tag

The bundle looks pretty stable. Could we add a 0.1.0 tag?

License

Hi! Could you make a final decision about the license? composer.json tells "license" : "GPL-2.0-or-later", shield in the README file tells MIT.

Thank you!

can we use tags?

Hi. We are looking to set tags under SwiftMailer. is this supported? if yes how can we use them?
Best

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.