> ## Documentation Index
> Fetch the complete documentation index at: https://superofficeas-bugfix-ty-screen-designer-paradox.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Email

> Class for representing and sending emails.

Class for representing and sending emails.

## Constructors

### Email()

```crmscript theme={null}
Email
```

Initializes a new instance of the Email class.

## Methods

## addAttachment(Integer,Bool)

Adds an attachment to the email object.

```crmscript theme={null}
String addAttachment(Integer attachmentId, Bool inline)
```

**Returns:** [CRMScript.Global.String](CRMScript.Global.String) - The ID of the attachment relative to the email.

## send()

Sends the email.

```crmscript theme={null}
Void send()
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

## setValue(String,String)

Sets the value of the given field in the email instance.

For multiple recipients, call setValue multiple times, once for each recipient.

```crmscript theme={null}
Void setValue(String name, String value)
```

**Returns:** [CRMScript.Global.Void](CRMScript.Global.Void)

<Note>
  Available fields:

  * from: The from address.
  * to: The recipient.
  * cc: The carbon copy recipient.
  * bcc: The bcc recipient.
  * sms: A cellphone number to send sms to.
  * smsFrom: The from address when sending sms.
  * subject: The subject of the email.
  * body: The plain text body of the email.
  * bodyHtml: The HTML formated body of the email.
  * ticketId: The ticketId, only used with sms.\</p
  * envelopeFrom
  * Sets the envelope from mail address. "From" will also be set if not already set

  \>\<p>From version 8.1 any other header value may also be added, for example setValue("X-Foo", "42");
</Note>
