Use altered Mail message object

Created on 10 June 2024, 5 months ago
Updated 12 September 2024, 2 months ago
    // Allow other modules to alter the Mandrill message.
    $sendgrid_params = [
      'message' => $sendgrid_message,
    ];
    \Drupal::moduleHandler()
      ->alter('sendgrid_integration', $sendgrid_params, $message);

    // Lets try and send the message and catch the error.
    try {
      $response = $client->send($sendgrid_message);
    }
    catch (SendgridException $e) {

The $sendgrid_message Mail object can be complemented but can never be replaced completely. We need replacement replacement capability because the object won't let us change/replace already set properties.

Changing $response = $client->send($sendgrid_message); to $response = $client->send($sendgrid_params['message']); solves this issue.

πŸ“Œ Task
Status

Fixed

Version

2.2

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium bceyssens Genk πŸ‡§πŸ‡ͺ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024