code: private MailRequest getMailRequest(Message message, MailEndpointConfiguration endpointConfiguration) {
          Object payload = message.getPayload();
  
          MailRequest mailRequest = null;
          if (payload != null) {
              if (payload instanceof MailRequest) {
                  mailRequest = (MailRequest) payload;
              } else {
                  mailRequest = (MailRequest) endpointConfiguration.getMarshaller()
                          .unmarshal(message.getPayload(Source.class));
              }
          }
  
          if (mailRequest == null) {
              throw new CitrusRuntimeException("Unable to create proper mail message from payload: " + payload);
          }
  
          return mailRequest;
      }
docs: Reads Citrus internal mail message model object from message payload. Either payload is actually a mail message object or
  XML payload String is unmarshalled to mail message object.
  
  @param message
  @param endpointConfiguration
  @return