GithubHelp home page GithubHelp logo

Comments (15)

paulmartin84 avatar paulmartin84 commented on May 23, 2024 2

Thanks @CupOfTea696 in the end my message was Please activate your Mailgun account. Check your inbox or log in to your control panel to resend the activation email. How frustrating!

from mailgun.

Bogardo avatar Bogardo commented on May 23, 2024

Hi @ivkean,
Do you have a mail.blade.php template in your views directory?

from mailgun.

lmquang avatar lmquang commented on May 23, 2024

yes, and it's code:
{{ $customer }}

from mailgun.

Bogardo avatar Bogardo commented on May 23, 2024

All required fields in the configuration file are entered?
https://github.com/Bogardo/Mailgun#configuration

from mailgun.

Bogardo avatar Bogardo commented on May 23, 2024

@ivkean Have you managed to solve the issue?

from mailgun.

lmquang avatar lmquang commented on May 23, 2024

@Bogardo
Not yet, i set up mailgun account free. Is that why i can not send mail ?

from mailgun.

CupOfTea696 avatar CupOfTea696 commented on May 23, 2024

I have the same issue. I checked my config file a million times. I always get those kinds of errors.

I get the error The parameters passed to the API were invalid. Check your inputs! on Mailgun::lists()->create() I'm using the exact code from the documentation.
When I call Mailgun::lists()->all(); everything works perfectly.

from mailgun.

CupOfTea696 avatar CupOfTea696 commented on May 23, 2024

I found the error. The problem is that the Mailgun-PHP package just throws that exception and disregards the data it gets. I edited the file where the error was and just did a var_dump() of the response it actually gets. Here's what came out:

{
  "message": "The 'address' parameter should be a valid email address"
}

Maybe you could find a way to catch the exception and add the data from the response? Because otherwise with errors like this you just have no clue what went wrong.

from mailgun.

Bogardo avatar Bogardo commented on May 23, 2024

@CupOfTea696 I'm glad you found the problem.
What kind of list 'address' did you create in the Mailgun Control Panel?
Never mind, you were creating a new list... :)

And which file did you change to get the error message?

from mailgun.

Bogardo avatar Bogardo commented on May 23, 2024

@CupOfTea696 I see you're already creating a PR on the mailgun/mailgun-php repo.
mailgun/mailgun-php#71 (comment)

They should probably do something like this:

public function responseHandler($responseObj){
        $httpResponseCode = $responseObj->getStatusCode();
        if($httpResponseCode === 200){
            $data = (string) $responseObj->getBody();
            $jsonResponseData = json_decode($data, false);
            $result = new \stdClass();
            // return response data as json if possible, raw if not
            $result->http_response_body = $data && $jsonResponseData === null ? $data : $jsonResponseData;
        }
        elseif($httpResponseCode == 400){
            $response = json_decode((string)$responseObj->getBody(), false);
            if (isset($response->message)) {
                throw new MissingRequiredParameters(EXCEPTION_MISSING_REQUIRED_PARAMETERS . " " . $response->message);
            }
            throw new MissingRequiredParameters(EXCEPTION_MISSING_REQUIRED_PARAMETERS);
        }
        elseif($httpResponseCode == 401){
            throw new InvalidCredentials(EXCEPTION_INVALID_CREDENTIALS);
        }
        elseif($httpResponseCode == 404){
            throw new MissingEndpoint(EXCEPTION_MISSING_ENDPOINT);
        }
        else{
            throw new GenericHTTPError(EXCEPTION_GENERIC_HTTP_ERROR, $httpResponseCode, $responseObj->getBody());
        }
        $result->http_response_code = $httpResponseCode;
        return $result;
    }

from mailgun.

CupOfTea696 avatar CupOfTea696 commented on May 23, 2024

Yeah, that's pretty close to what I have. I'll create a pull request in a sec.

from mailgun.

Bogardo avatar Bogardo commented on May 23, 2024

@CupOfTea696 There is no need to add this to the EXCEPTION_INVALID_CREDENTIALS and EXCEPTION_MISSING_ENDPOINT these are fine the way they are. Just the EXCEPTION_MISSING_REQUIRED_PARAMETERS should do.

from mailgun.

CupOfTea696 avatar CupOfTea696 commented on May 23, 2024

Trust me, I had a 404 error earlier which I wouldn't have figured out if it wasn't for the response data. It just said the url was wrong, while the actual problem was that I was trying to get() a list that didn't exist (because I thought you could check if the list existed that way but instead it throws this error).

from mailgun.

Bogardo avatar Bogardo commented on May 23, 2024

The InvalidCredentials exception returns the message "Your credentials are incorrect." which should be sufficient.
The MissingEndpoint exception does return the message Mailing list [email protected] not found when trying to get a non-existent resource.

But when you try to access a completely non-existent url/path like /test you get the following response:
error
Which isn't really what you want.

from mailgun.

kldeepak avatar kldeepak commented on May 23, 2024

Hi @Bogardo ,

I faced same issue ("The parameters passed to the API were invalid. Check your inputs!") when I tried to add a domain that exists already in the same account. I updated responseHandler function to get correct error message. Just want to check whether the code is merged into main repo or not.

from mailgun.

Related Issues (20)

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.