public function send() {
    if (!$this->message->hasSender()) {
      throw new \InvalidArgumentException(
          "Required field sender is not provided.");
    } else if ($this->message->getToSize() == 0 &&
              $this->message->getCcSize() == 0 &&
              $this->message->getBccSize() == 0) {
      throw new \InvalidArgumentException(
          "Neither to, cc or bcc is set - at least one is required.");
    } else if (!$this->message->hasSubject()) {
      throw new \InvalidArgumentException(
          "Required field subject is not provided.");
    } else if (!$this->message->hasTextbody() &&
              !$this->message->hasHtmlbody()) {
      throw new \InvalidArgumentException(
          "Neither a plain-text nor HTML body is provided - at least one is " .
          "required.");
    }

    $response = new VoidProto();
    try {
      ApiProxy::makeSyncCall(
          'mail', 'Send', $this->message, $response);
    } catch(ApplicationError $e) {
      $this->handleApplicationError($e);
    }
  }
public function send() {
    if (!$this->message->hasSender()) {
      throw new \InvalidArgumentException(
          "Required field sender is not provided.");
    } else if ($this->message->getToSize() == 0 &&
              $this->message->getCcSize() == 0 &&
              $this->message->getBccSize() == 0) {
      throw new \InvalidArgumentException(
          "Neither to, cc or bcc is set - at least one is required.");
    } else if (!$this->message->hasSubject()) {
      throw new \InvalidArgumentException(
          "Required field subject is not provided.");
    } else if (!$this->message->hasTextbody() &&
              !$this->message->hasHtmlbody()) {
      throw new \InvalidArgumentException(
          "Neither a plain-text nor HTML body is provided - at least one is " .
          "required.");
    }

    $response = new VoidProto();
    try {
      ApiProxy::makeSyncCall(
          'mail', 'Send', $this->message, $response);
    } catch(ApplicationError $e) {
      $this->handleApplicationError($e);
    }
  }
public function send ( ) { if ( ! $ this -> message -> hasSender ( ) ) { throw new \ InvalidArgumentException ( "Required field sender is not provided." ) ; } else if ( $ this -> message -> getToSize ( ) == 0 && $ this -> message -> getCcSize ( ) == 0 && $ this -> message -> getBccSize ( ) == 0 ) { throw new \ InvalidArgumentException ( "Neither to, cc or bcc is set - at least one is required." ) ; } else if ( ! $ this -> message -> hasSubject ( ) ) { throw new \ InvalidArgumentException ( "Required field subject is not provided." ) ; } else if ( ! $ this -> message -> hasTextbody ( ) && ! $ this -> message -> hasHtmlbody ( ) ) { throw new \ InvalidArgumentException ( "Neither a plain-text nor HTML body is provided - at least one is " . "required." ) ; } $ response = new VoidProto ( ) ; try { ApiProxy :: makeSyncCall ( 'mail' , 'Send' , $ this -> message , $ response ) ; } catch ( ApplicationError $ e ) { $ this -> handleApplicationError ( $ e ) ; } }
Send the pre-formed email from the Message object.

@throws \InvalidArgumentException If a required field (sender, recipient
[to, cc or bcc], subject, body [plain or html]) is missing, or if an
ApplicationError was thrown by the RPC call due to an unauthorized
sender, an invalid attachment type, or an invalid header name.
@throws \RuntimeException If an ApplicationError was thrown by the RPC call
due to an internal error or bad request.
@throws ApplicationError If there was an unknown error in the RPC call.
Send the pre - formed email from the Message object .