# sendMail

## Description

Sends an email through the app.

## Input / Parameter

| Name       | Description                                | Input Type | Default | Options | Required |
| ---------- | ------------------------------------------ | ---------- | ------- | ------- | -------- |
| config     | The configuration of the email to be sent. | Object     | -       | -       | Yes      |
| from       | The name of the sender.                    | Object     | -       | -       | Yes      |
| to         | The name of the recipient.                 | Array/List | -       | -       | Yes      |
| cc         | The carbon copy.                           | Array/List | -       | -       | No       |
| bcc        | The blind carbon copy.                     | Array/List | -       | -       | No       |
| data       | The contents of the email.                 | Object     | -       | -       | Yes      |
| attachment | The file(s) to be attached.                | Array/List | -       | -       | No       |

## Output

N/A

## Callback?

### callback

The function to be executed when the email is sent successfully.

### errCallback

The function to be executed when the email is not sent successfully.

## Video

Coming Soon.

## Example

The user want to send an email via the app.

### Step

1. Call the sendMail function, add toObject function in "config" parameter as below:

   ![](/files/Yumov5Lk4XtGJX7iIehR)
2. For "from" paremeter, add toObject with "email" & "name".

   ![](/files/RtDOs11zwYsC7GzS6cfB)
3. For "to" paremeter, add toArray function then toObject funtion.

   ![](/files/OPMFjU1bjeiYCdoBgB4z)

   Add fields "email" & "name".

   ![](/files/RDZq2qOvUdJG8wqXGEWD)
4. For "cc" paremeter, add toArray function then toObject funtion.

   ![](/files/h0CPPxJtYkyf4taFMGDP)

   Add fields "email" & "name".

   ![](/files/p87Tc0Ldsi2o2nF88p34)
5. For "data" paremeter, add toObject function then add fields "subject" "body".

   ![](/files/diftfCTrFaxTn808qzOD)

### Result

Email Received: ![](/files/S7ttbgsytOsmwINFvSeN)

## Links


---

# 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.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/app/sendmail.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.
