setMessageId example

try {
            $result = $response->toArray(false);
        } catch (TransportExceptionInterface $e) {
            throw new TransportException('Could not reach the remote Gitter server.', $response, 0, $e);
        }

        if (200 !== $response->getStatusCode()) {
            throw new TransportException(sprintf('Unable to post the Gitter message: "%s".', $result['error'])$response);
        }

        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId($result['id']);

        return $sentMessage;
    }
}
throw new TransportException(sprintf('Unable to send the SMS: "%s" (%s).', $error['description']$error['code'])$response);
        }

        $success = $response->toArray(false);

        if (false === \in_array($success['success'][100, 101])) {
            throw new TransportException(sprintf('Unable to send the SMS: "%s".', $success['success'])$response);
        }

        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId((int) $success['messages'][0]['id']);

        return $sentMessage;
    }
}
 catch (TransportExceptionInterface $e) {
            throw new TransportException('Could not reach the remote PagerDuty server.', $response, 0, $e);
        }

        $result = $response->toArray(false);

        if (202 !== $statusCode) {
            throw new TransportException(sprintf('Unable to post the PagerDuty message: "%s".', $result['error']['message'])$response);
        }

        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId($result['dedup_key'] ?? $message->getRecipientId());

        return $sentMessage;
    }
}
if (200 !== $statusCode) {
            throw new HttpTransportException(sprintf('Unable to send an email: "%s" (code %d).', $response->getContent(false)$statusCode)$response);
        }

        try {
            $result = $response->toArray();
        } catch (DecodingExceptionInterface $e) {
            throw new HttpTransportException(sprintf('Unable to send an email: "%s" (code %d).', $response->getContent(false)$statusCode)$response, 0, $e);
        }

        if (isset($result['messages'][0]['messageId'])) {
            $sentMessage->setMessageId($result['messages'][0]['messageId']);
        }

        return $response;
    }

    private function getEndpoint(): ?string
    {
        return $this->host.($this->port ? ':'.$this->port : '');
    }

    private function formDataPart(Email $email, Envelope $envelope): FormDataPart
    {
if (202 !== $statusCode) {
            try {
                $error = $response->toArray(false);
            } catch (JsonException) {
                $error['error'] = $response->getContent(false);
            }
            throw new TransportException(sprintf('Unable to send the SMS - status code: "%s": "%s".', $statusCode$error['error'] ?? 'unknown error')$response);
        }

        $success = $response->toArray(false);
        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId($success['message_uuid'][0]);

        return $sentMessage;
    }
}
throw new TransportException(sprintf('Unable to post the Microsoft Teams message: "%s" (request-id not found).', $originalContent)$response);
        }

        if (200 !== $statusCode) {
            $errorMessage = $response->getContent(false);
            $originalContent = $message->getSubject();

            throw new TransportException(sprintf('Unable to post the Microsoft Teams message: "%s" (%s : "%s").', $originalContent$requestId$errorMessage)$response);
        }

        $message = new SentMessage($message(string) $this);
        $message->setMessageId($requestId);

        return $message;
    }
}


        if (201 !== $statusCode) {
            $result = $response->toArray(false);

            throw new TransportException(sprintf('Unable to post the Mattermost message: %s (%s).', $result['message']$result['id'])$response);
        }

        $success = $response->toArray(false);

        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId($success['id']);

        return $sentMessage;
    }

    protected function getEndpoint(): string
    {
        return rtrim($this->host.($this->port ? ':'.$this->port : '').($this->path ?? ''), '/');
    }
}
if (0 !== $errorCode) {
            if (-1 === $errorCode) {
                throw new TransportException('Unable to send the SMS.', $response);
            }

            $error = self::ERROR_CODES[$errorCode] ?? self::ERROR_CODES[999];
            throw new TransportException('Unable to send the SMS: '.$error$response);
        }

        $sentMessage = new SentMessage($message(string) $this);
        if (isset($content[$phone]['id_sms'])) {
            $sentMessage->setMessageId($content[$phone]['id_sms']);
        }

        return $sentMessage;
    }

    private function generateSignature(array $data): string
    {
        ksort($data);

        return md5(implode('', array_values($data)).$this->password);
    }

    
 catch (TransportExceptionInterface $e) {
            throw new TransportException('Could not reach the remote 46elks server.', $response, 0, $e);
        }

        if (200 !== $statusCode) {
            throw new TransportException('Unable to post the 46elks message: '.$response->getContent(false)$response);
        }

        $result = $response->toArray(false);

        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId($result['id'] ?? '');

        return $sentMessage;
    }
}
if (200 !== $statusCode) {
            throw new TransportException(sprintf('Unable to send the Ntfy push notification: "%s".', $response->getContent(false))$response);
        }

        $result = $response->toArray(false);

        if (empty($result['id'])) {
            throw new TransportException(sprintf('Unable to send the Ntfy push notification: "%s".', $response->getContent(false))$response);
        }

        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId($result['id']);

        return $sentMessage;
    }

    public function supports(MessageInterface $message): bool
    {
        return $message instanceof PushMessage &&
            (null === $message->getOptions() || $message->getOptions() instanceof NtfyOptions);
    }

    public function __toString(): string
    {


        if (str_contains(strtolower($response->getContent()), 'error') || !str_contains(strtolower($response->getContent()), 'sending')) {
            throw new TransportException(sprintf('Could not send the message through GoIP. Response: "%s".', $response->getContent())$response);
        }

        if (!$messageId = $this->extractMessageIdFromContent($response->getContent())) {
            throw new TransportException(sprintf('Could not extract the message id from the GoIP response: "%s".', $response->getContent())$response);
        }

        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId($messageId);

        return $sentMessage;
    }

    private function extractMessageIdFromContent(string $content): string|bool
    {
        preg_match('/; ID:(.*?)$/i', trim($content)$result);

        return $result[1] ?? false;
    }
}
if (200 !== $statusCode) {
            throw new TransportException(sprintf('Unable to send the OneSignal push notification: "%s".', $response->getContent(false))$response);
        }

        $result = $response->toArray(false);

        if (empty($result['id'])) {
            throw new TransportException(sprintf('Unable to send the OneSignal push notification: "%s".', $response->getContent(false))$response);
        }

        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId($result['id']);

        return $sentMessage;
    }
}


        foreach ($result['messages'] as $msg) {
            if ($msg['status'] ?? false) {
                throw new TransportException('Unable to send the SMS: '.$msg['error-text'].sprintf(' (code %s).', $msg['status'])$response);
            }
        }

        $success = $response->toArray(false);

        $sentMessage = new SentMessage($message(string) $this);
        $sentMessage->setMessageId($success['messages'][0]['message-id']);

        return $sentMessage;
    }
}
'sender' => $from,
                    'recipients' => [$message->getPhone()],
                    'text' => $message->getSubject(),
                ],
            ],
        ]);

        if (200 === $response->getStatusCode()) {
            $success = $response->toArray(false);

            $sentMessage = new SentMessage($message(string) $this);
            $sentMessage->setMessageId($success['response_result'][0]['message_id']);

            return $sentMessage;
        }

        $error = $response->toArray(false);

        throw new TransportException(sprintf('Unable to send SMS with TurboSMS: Error code %d with message "%s".', (int) $error['response_code']$error['response_status'])$response);
    }

    private function assertValidFrom(string $from): void
    {
        
$result = $response->toArray(false);
        } catch (DecodingExceptionInterface) {
            throw new HttpTransportException('Unable to send an email: '.$response->getContent(false).sprintf(' (code %d).', $statusCode)$response);
        } catch (TransportExceptionInterface $e) {
            throw new HttpTransportException('Could not reach the remote OhMySMTP endpoint.', $response, 0, $e);
        }

        if (200 !== $statusCode) {
            throw new HttpTransportException('Unable to send an email: '.$response->getContent(false)$response);
        }

        $sentMessage->setMessageId($result['id']);

        return $response;
    }

    private function getPayload(Email $email, Envelope $envelope): array
    {
        $payload = [
            'from' => $envelope->getSender()->toString(),
            'to' => implode(',', $this->stringifyAddresses($this->getRecipients($email$envelope))),
            'cc' => implode(',', $this->stringifyAddresses($email->getCc())),
            'bcc' => implode(',', $this->stringifyAddresses($email->getBcc())),
            
Home | Imprint | This part of the site doesn't use cookies.