> For the complete documentation index, see [llms.txt](https://docs.emobiq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/app/sendmail.md).

# 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:

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-de1e1e2f99bd85443ba421641e1079abcad57b3c%2FsendMail-step-1.png?alt=media)
2. For "from" paremeter, add toObject with "email" & "name".

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-367dd280797a2fbc18f2b9e24622b01c3c945b80%2FsendMail-step-2.png?alt=media)
3. For "to" paremeter, add toArray function then toObject funtion.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-dfed6e68fa86c978facce8330bdebc03b6a299dd%2FsendMail-step-3.png?alt=media)

   Add fields "email" & "name".

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-1f8dd04df27b8f9ca1c4d089987a03fd6beedf9e%2FsendMail-step-5.png?alt=media)
4. For "cc" paremeter, add toArray function then toObject funtion.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-723b9effd36b48f408a35489938916c757f86aa0%2FsendMail-step-4.png?alt=media)

   Add fields "email" & "name".

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-af61cde66a9c05473ec4d2634ab8a26280e8dd95%2FsendMail-step-6.png?alt=media)
5. For "data" paremeter, add toObject function then add fields "subject" "body".

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-a397bbc7e07ed0aa6da3164e593c658566d20736%2FsendMail-step-7.png?alt=media)

### Result

Email Received: ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-74602234f435c23f2be3ff8ef5c15c867ae8bc5b%2FsendMail-result-1.png?alt=media)

## Links
