Giter Club home page Giter Club logo

cakephp-mailgun's Introduction

Mailgun Plugin for CakePHP

Build Status Coverage Status Codacy Badge Latest Stable Version PHP from Travis config Software License Total Downloads Codacy Badge PHPStan Level

This plugin provides email delivery using Mailgun API.

This branch is for use with CakePHP 4.0+. For details see version map

Installation and Usage

See documentation

Contributing

You can fork the project, add features, and send pull requests or open issues.

Reporting Issues

If you are facing a problem with this plugin or found any bug, please open an issue on GitHub.

cakephp-mailgun's People

Contributors

alysson-azevedo avatar challgren avatar dakota avatar dkvasani avatar jkimbrel avatar johanmeiring avatar narendravaghela avatar stickler-ci avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cakephp-mailgun's Issues

Use MailgunEmail features in Mailers

When updating to version 4.0.0 and introducing the new MailgunEmail class, I don't know if you can use it in Mailer classes or you just have to use the default Email class.

It would be useful to use the MailgunEmail class methods inside Mailer configuration, like enableDkim, setTags and so.

Mailgun EU Support is missing.

I am using this library with eu mailgun api. The problem is url is different than US. For now i edited the Mailgun.php $apiendpoint variable. It will be great to configure it from app.php.

i am facing this issue

Your code is work on localhostbut serve side i am facing this issue Transport class "MailgunEmail.Mailgun" not found in cakephp 3.4

Sending emails in a loop causing _formData to persist

In Cake4, Mailer class clone transport before executing deliver method, then it restores the transport instance. When MailgunTransport is clone, the FormData instance in _formData property is shared between the two instances (original and clone) so even when _reset is called after sending email, the cloned instance keeps the previous _formData generating emails with multiple to, subject and from headers.

Calling _reset in new instance fixes the issue

How to use inline attachments?

On cake, we use

$email->setAttachments([
    'logo.png' => [
        'file' => WWW_ROOT . Configure::read('App.imageBaseUrl') . 'logo.png',
        'contentId' => 'logo'
    ]
])

But on the mailgun-php is

$mg->message()->send('example.com', [
  'from'    => '[email protected]', 
  'to'      => '[email protected]', 
  'subject' => 'Test inline attachments', 
  'text'    => 'Test',
  'inline' => [
    ['filePath'=>'/tmp/foo.jpg', 'filename'=>'test.jpg']
  ]
]);

So, is it possible to send inline attachments with this plugin?

CakePHP 3.7 deprecations

In CakePHP 3.7 the following deprecation warnings are emitted.

Deprecated Error: Response::json is deprecated. Use Response::getJson() instead. - /vendor/narendravaghela/cakephp-mailgun/src/Mailer/Transport/MailgunTransport.php, line: 362

I can submit a PR later this week on to fix this

Domain

Hi there, great job on this integration. I've one question, how do I set a domain dynamically? E.g. for some cases i use mg.domain1.com and some mg.domain2.com?

Mailgun\Tests\Mock\Mailgun is not available on mailgun-php after version 2.1

I'm writing a pull request to make this plugin pass on Cake 3.6.

When i updated the composer.json, the mailgun-php was updated to the version 2.5.
On their CHANGELOG, lots of things was changed.

The main problem is that after 2.1, their "/tests/" directory is not shipped by composer, so now this line fails:
https://github.com/narendravaghela/cakephp-mailgun/blob/master/src/Mailer/Transport/MailgunTransport.php#L22

So, i'll force the composer to stick on the mailgun-php 2.1, and leave the update to 2.5 for another pull-request.

cURL resolving timed out Mac Os Mojave

Hi,
I'm having an issue that is driving me nuts right now.

My CakePHP version is 3.8.1 and I have this plugin installed with the transport and profile properly configured and working.

When I deploy my application in any server everything works like charm. The Mailgun responds very quickly and I don't have any kind of problem.

The issue comes when I run my app in my local machine (where I develop everything so is slowing me down a lot). I have a Mac Os Mojave laptop with LAMP stack installed via Homebrew. I've tried with different PHP versions (5.6, 7.0, 7.1, 7.2 and 7.3)

When I try to send a message via Mailgun I always get this timeout error. I'm connected to my company network.
Captura de pantalla 2019-07-24 a las 10 38 15

I can't figure out why this error appears since I have my local machine configured as a standard web server with a LAMP stack.

The funny thing comes when I try to change my network connection. If I share internet from my mobile phone or work at home I don't get any timeout and everything works as expected.

For further information, if I try to run the standard PHP code showed in the Mailgun Docs or use Postman to replicate any API call it works in every network.

Any help would be useful. Thank you in advance.

Deprecated warnings in CakePHP 3.6

The MailgunTransport class is throwing deprecation errors about the use of the "config" method. Now, we have to use "setConfig/getConfig" instead.

Issue when sending emails with attachments in 1.0.6

Warning Error: fopen() expects parameter 1 to be a valid path, array given in [/home/mrogers/Dropbox/cakephp/webapp/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php, line 310]

2018-06-27 22:40:15 Warning: Warning (2): fopen() expects parameter 1 to be a valid path, array given in [/home/mrogers/Dropbox/cakephp/webapp/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php, line 310]
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE/src/Error/BaseErrorHandler.php, line 153
fopen - [internal], line ??
Mailgun\Connection\RestClient::prepareFile() - ROOT/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php, line 310
Mailgun\Connection\RestClient::post() - ROOT/vendor/mailgun/mailgun-php/src/Mailgun/Connection/RestClient.php, line 154
Mailgun\Mailgun::post() - ROOT/vendor/mailgun/mailgun-php/src/Mailgun/Mailgun.php, line 204
Mailgun\Mailgun::sendMessage() - ROOT/vendor/mailgun/mailgun-php/src/Mailgun/Mailgun.php, line 135
MailgunEmail\Mailer\Transport\MailgunTransport::_sendMessage() - ROOT/vendor/narendravaghela/cakephp-mailgun/src/Mailer/Transport/MailgunTransport.php, line 216
App\Mailer\Transport\MailgunTransport::send() - APP/Mailer/Transport/MailgunTransport.php, line 95
Cake\Mailer\Email::send() - CORE/src/Mailer/Email.php, line 2118
EmailQueue\Shell\SenderShell::main() - ROOT/plugins/EmailQueue/src/Shell/SenderShell.php, line 106
Cake\Console\Shell::runCommand() - CORE/src/Console/Shell.php, line 507
Cake\Console\CommandRunner::run() - CORE/src/Console/CommandRunner.php, line 141
[main] - ROOT/bin/cake.php, line 12

No issues with 1.0.5.

BCC

Hey

First off all, great plugin!

Is it possible that bcc doesn't work? Also, how do you add multiple contacts?

Best regards
Jordy

Transport class "mailgun" not found.

I've noticed that MailgunTransport.php uses "use Cake\Mailer\Email;"

If I'm not mistaken this namespace doesn't exist in versions prior to 3.1.

My app.php:

'EmailTransport' => [
...
 'mailgun' => [
            'className' => 'MailgunEmail.Mailgun',
            'apiKey' => 'key-xxxxxxxxxxxxxxxxxxxxxxxxxxx', 
            'domain' => 'sandboxxxxxxxxxxxxxxxxxxxxxxxxxxxx.mailgun.org' 
        ]
],
'Email' => [
'mailgun' => [
            'transport' => 'mailgun'
        ]

 ],

In my controller:

use Cake\Network\Email\Email;

` $email = new Email('mailgun');

    $result = $email->from(['[email protected]' => 'Test'])

        ->to('[email protected]')
        ->subject('newsletter')
        ->template('send', 'send')
        ->viewVars(['news' => $news, 'newsletter' => $newsletter, 'newsDestaque' => $newsDestaque, 'imagemDestaque' => $imagemDestaque, 'domain_id' => $domain_id])
        ->emailFormat('both')
        ->addHeaders(['o:tag' => 'testing'])
        ->addHeaders(['o:deliverytime' => strtotime('+1 Min')])
        ->send();`

Class 'App\Controller\MailgunEmail' not found

Something is wrong with the namespace registry.

Following the doc step by step with cakephp 3.7

Instantiation fails.
$email = new MailgunEmail();

triggers:
Class 'App\Controller\MailgunEmail' not found

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.