code: private function createMailEvent(
          Email $email,
          string $name,
          ResultInterface $result = null
      ): MailEvent {
          $event = new MailEvent($email, $name);
          if ($result !== null) {
              $event->setResult($result);
          }
  
          return $event;
      }
docs: Creates a new MailEvent object
  @param Email $email
  @param string $name
  @param ResultInterface $result
  @return MailEvent