# CID

CID é uma maneira especial de inserir imagens ou outros arquivos de mídia diretamente no corpo do e-mail, para que sejam exibidos imediatamente, sem a necessidade de baixá-los separadamente.

1. No e-mail, as imagens são inseridas através da tag `<img src='cid:ID_único'>`.
2. O ID único (Content-ID) vincula a imagem a essa tag.
3. No banco de dados, esses IDs e as próprias imagens são armazenados.
4. Ao exibir o e-mail, o programa procura as imagens por esses IDs e as mostra.

> Essa construção funciona para páginas da web, no entanto, o Outlook pode não exibir essas imagens. Isso é especialmente relevante para o Office 2019.

## Configurações de conexão com o Exchange

<pre class="language-html" data-overflow="wrap"><code class="lang-html">$exchangeVersion = [Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2016 
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService($exchangeVersion) 
<strong>$service.Credentials = New-Object System.Net.NetworkCredential($        , $        ) 
</strong>$service.Url = "https://        /        /Exchange.asmx"
</code></pre>

## Criação do e-mail

```html
$email = New-Object Microsoft.Exchange.WebServices.Data.EmailMessage($service) 
$email.Subject = $subject 
$email.Body = New-Object Microsoft.Exchange.WebServices.Data.MessageBody( 
    [Microsoft.Exchange.WebServices.Data.BodyType]::HTML, 
    "<html><body><p style = `"font-size: 15px; font-family: Calibri;`">${$header}<br>${$link}<br></p><img src='cid:MyImage'>$($        )</body></html>"
)
$emailAddresses = $Row.emails -split ';' | ForEach-Object { $_.Trim() } 
foreach ($address in $emailAddresses) { 
    $email.ToRecipients.Add($address) 
}
```

## Adição de anexo com ContentId

```html
$filePath = $        
$attachment = $email.Attachments.AddFileAttachment($filePath) 
$attachment.ContentId = "MyImage" 
$attachment.IsInline = $true
```

## Envio do e-mail

```html
$email.SendAndSaveCopy()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sherparpa.ru/pt/sherpa-rpa/sherpa-designer/rabota-v-sherpa-designer/paneli-svoistv-i-peremennykh-i-rabota-s-nimi/panel-svoistv/rabota-s-vyrazheniyami/cid.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
