# MailSend

### Summary

* Sends a new email to one or more recipients.

### Graph Endpoint

* `POST /me/sendMail`

### Parameters

#### Required

* `to: string[]` — Recipient email addresses.

#### Optional

* `cc: string[]`, `bcc: string[]`
* `subject: string`, `body: string`
* `bodyContentType: 'Text'|'HTML'` — default `Text`
* `saveToSentItems: boolean` — default `true`
* `attachmentIds: number[]` — Up to 10 repository attachment IDs; backend attaches the files automatically before sending.

### Usage (app.businessFunction)

#### Minimal

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'Send',
  parameters: {
    to: ['adelev@contoso.com'],
    subject: 'Hello',
    body: 'Hi there!'
  }
})
```

#### With options

```js
app.businessFunction({
  functionName: 'MicrosoftGraph',
  methodName: 'Mail',
  operation: 'Send',
  parameters: {
    to: ['team@contoso.com'],
    cc: ['manager@contoso.com'],
    subject: 'Weekly Update',
    body: '<p>Summary...</p>',
    bodyContentType: 'HTML',
    saveToSentItems: true,
    attachmentIds: [1012, 1013] // up to 10 attachments
  }
})
```

### Response

```json
{ "ok": true }
```

### Notes

* When `attachmentIds` are provided, the system creates a draft, uploads the files, and then sends the draft — all in a single call.
* The IDs must reference attachments that still have accessible file data (either in DB or in external storage). If a blob was removed, update or re-upload the attachment.
