Skip to content

[Mailer][MailPace] "throw new HttpTransportException" cause a "Undefined array key 'Message' or 'ErrorCode' " #49169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
selimanac opened this issue Jan 31, 2023 · 0 comments

Comments

@selimanac
Copy link

selimanac commented Jan 31, 2023

Symfony version(s) affected

6.2.5

Description

mail-pace-mailer failed to throw new HttpTransportException because of the missing array keys.

When return status code is not 200, it failed because of the typo on line 70.
$result array doesn't contain Message or ErrorCode

Instead of Message , mail-pace api returns error:

  "error" => "Invalid API Token"

mail-pace api responses: https://docs.mailpace.com/reference/responses

How to reproduce

Just use a any wrong API key or send it with not verified domain.

Possible Solution

Changing Message to error and $result['ErrorCode'] to $statusCode might fix it.

throw new HttpTransportException('Unable to send an email: '.$result['error'].sprintf(' (code %d).', $statusCode), $response);

Additional Context

No response

@selimanac selimanac added the Bug label Jan 31, 2023
selimanac added a commit to selimanac/mail-pace-mailer that referenced this issue Jan 31, 2023
@xabbuh xabbuh added the Mailer label Feb 1, 2023
@OskarStark OskarStark changed the title [mail-pace-mailer] "throw new HttpTransportException" cause a "Undefined array key 'Message' or 'ErrorCode' " [Mailer][MailPace] "throw new HttpTransportException" cause a "Undefined array key 'Message' or 'ErrorCode' " Feb 3, 2023
fabpot added a commit that referenced this issue Feb 4, 2023
…skarStark)

This PR was merged into the 6.2 branch.

Discussion
----------

[Mailer] [MailPace] Fix undefined key in error response

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #49169
| License       | MIT
| Doc PR        | -

cc `@selimanac`

Commits
-------

841f8a6 [Mailer][MailPace] Fix undefined key in error response
@fabpot fabpot closed this as completed Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants