sendEmailWithHttpInfo method

Future<Response> sendEmailWithHttpInfo(
  1. SendEmailRequest sendEmailRequest, {
  2. String? xWorkspaceID,
})

Send an email.

Sends through the resolved connected account (auto-picks if the caller has exactly one connected mail account; errors ambiguous_account otherwise unless accountId is supplied).

Note: This method returns the HTTP Response.

Parameters:

  • SendEmailRequest sendEmailRequest (required):

  • String xWorkspaceID: Workspace scope for unscoped tokens. Workspace-scoped PATs and OAuth tokens carry this implicitly; for session/JWT auth without a scoped PAT, pass it explicitly.

Implementation

Future<Response> sendEmailWithHttpInfo(SendEmailRequest sendEmailRequest, { String? xWorkspaceID, }) async {
  // ignore: prefer_const_declarations
  final path = r'/v1/mail/send';

  // ignore: prefer_final_locals
  Object? postBody = sendEmailRequest;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (xWorkspaceID != null) {
    headerParams[r'X-Workspace-ID'] = parameterToString(xWorkspaceID);
  }

  const contentTypes = <String>['application/json'];


  return apiClient.invokeAPI(
    path,
    'POST',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}