recipient = $recipient; $this->from = $from; $this->subject = $subject; $this->content = $content; } public function jsonSerialize() { return [ 'recipients' => [ [ 'email' => $this->recipient->email, 'name' => $this->recipient->name ] ], 'from' => [ 'email' => $this->from->email, 'name' => $this->from->name, ], 'subject' => $this->subject, 'contents' => [ [ 'type' => 'text/html', 'body' => $this->content ] ] ]; } }