Use altered Mail message object

Created on 10 June 2024, 18 days 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

Needs review

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.69.0 2024