Problem/Motivation

When using the Mailgun module I receive a "There was a problem sending your message and it was not sent." error when submitting the contact form. However, the email was sent fine. The issue seems to be line 246 of src/Form/ContactForm.php that checks if $result['result'] !== TRUE. Mailgun however returns an object with an id and message.

  "result" => Mailgun\Model\Message\SendResponse {#2598 ▼
    -id: "<20240814210540.123456789abcd@example.com>"
    -message: "Queued. Thank you."
  }

Proposed resolution

Reverse the check to

$result['result'] === FALSE

or simplify it to

if (empty($result['result']))
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jphelan created an issue. See original summary.

jphelan’s picture

StatusFileSize
new981 bytes
jphelan’s picture

Status: Active » Needs review
jphelan’s picture

Issue summary: View changes
jphelan’s picture

Issue summary: View changes
jphelan’s picture

Issue summary: View changes
nagy.balint’s picture

I think, we need to go with empty, cause FALSE is fail, and NULL is cancelled.
in core they use if (!$message['result']) { but likely empty is better.

jphelan’s picture

Ok, I've created a new revised MR.

jphelan’s picture

StatusFileSize
new1.87 KB
nagy.balint’s picture

nagy.balint’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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