formDataPart example

parent::__construct($client$dispatcher$logger);
    }

    public function __toString(): string
    {
        return sprintf('infobip+api://%s', $this->getEndpoint());
    }

    protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $envelope): ResponseInterface
    {
        $formData = $this->formDataPart($email$envelope);

        $headers = $formData->getPreparedHeaders()->toArray();
        $headers[] = 'Authorization: App '.$this->key;
        $headers[] = 'Accept: application/json';

        $response = $this->client->request(
            'POST',
            sprintf('https://%s/email/%s/send', $this->getEndpoint(), self::API_VERSION),
            [
                'headers' => $headers,
                'body' => $formData->bodyToIterable(),
            ]
Home | Imprint | This part of the site doesn't use cookies.