I downloaded the mailgun project's latest release -- because of fixed security issues -- and found I needed to follow the instructions in this comment in order for the library to be located:

https://www.drupal.org/node/2547591#comment-11804377

that is:

cd sites/all/libraries/mailgun
composer require --update-no-dev mailgun/mailgun-php

I also found that I need to add:

composer require php-http/guzzle6-adapter

... because the 'message factory' required by php-http/message is only included in --dev composer builds!

Additionally, a patch is needed to the library detect code because the mailgun library file is now Api.php rather than Constants.php, and the pattern used in the module to extract the version no longer matches: the code now uses ' rather than " strings.

Comments

rivimey created an issue. See original summary.

rivimey’s picture

StatusFileSize
new1.55 KB

The attached patch 'works for me': I expect it will fail on older-than-2.1 versions of the Mailgun php library (possibly not even v2.0), however.

I expect that could be avoided by recoding the version arguments as a version callback function, but that is for another day.

Note: there are two library 'version' numbers in play here: the SDK version and the code version. The SDK version appears to be related to the library API (1.7 at present), while the code version is the thing tagged in git (2.1.2 at present). The code version does not appear to be present in the downloaded code, making it hard to adapt :(

rivimey’s picture

Status: Needs work » Needs review
rivimey’s picture

Assigned: rivimey » Unassigned
balagan’s picture

Status: Needs review » Reviewed & tested by the community

I have followed your install instructions, and applied the patch. It's all good, I have successfully sent myself a test email from devel/php using the current API.

tijsdeboeck’s picture

Had to manually apply the patch, but the code works.

sokru’s picture

StatusFileSize
new1.45 KB

Updated patch so it applies cleanly on latest -dev.

jackbravo’s picture

StatusFileSize
new1.43 KB

You don't need to run any composer command other than "composer install". In particular:

> composer require --update-no-dev mailgun/mailgun-php

would download the same as the zip that you already downloaded from github: the mailgun-php library.

The patch needs this change:

+ 'file' => 'src/Mailgun/Constants/Api.php',

instead of

+ 'file' => 'vendor/mailgun/mailgun-php/src/Mailgun/Constants/Api.php',

rivimey’s picture

Hi jackbravo, the patch was designed to pull mailgun from composer, no zip required. Other workflows are available :)

bohart’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.07 KB

1) Mailgun does not update those files for SDK versions:

src/Mailgun/Constants/Api.php
src/Mailgun/Constants/Constants.php 

It always said the same for any versions.
Additionally, those files are deprecated and will be removed in 3.0 release.

2) The only one place where SDK version updated is CHANGELOG.md file.

3) Drupal 7 requires PHP 5.2, Mailgun module requires PHP 5.3.
That's why should not use short array syntax (introduced in PHP 5.4).

An updated patch attached.

bohart’s picture

In the meantime, I have updated the installation section of the documentation:
https://www.drupal.org/node/2547591

  • Matroskeen committed 918d8bd on 7.x-1.x authored by bohart
    Issue #2866627 by rivimey, bohart, sokru, jackbravo: Library v2.x not...
matroskeen’s picture

Status: Needs review » Fixed

Hi @bohart, your patch works well for me. It is committed to 7.x-1.x.

Other guys, thank you for your activity!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rivimey’s picture