---
title: add_email
slug: docs/addemail
docTags: 
createdAt: 2021-08-04T18:22:53.000Z
---

This adds a presentation of emails to the list of emails which have been previously sent to a user, and the system will not send any emails to your users. You can use this to keep track of emails not sent out through Regpack.&#x20;

# Basic parameters

| Name         | Type    | Required | Description                                                                                                         |
| ------------ | ------- | -------- | ------------------------------------------------------------------------------------------------------------------- |
| `action`     | string  | true     | `add_email`                                                                                                         |
| `clogin_id`  | integer | true     | This is a central login id which identifies a single user between any projects within your organization.            |
| `group_id`   | integer | true     | This designates which project the action should be applied towards.                                                 |
| `doc`        | array   | true     | `doc` should contain `email_list`.                                                                                  |
| `email_list` | array   | true     | This should be JSON array which describes the emails you'd like to add to the users email list. See below for more. |

# `email_list` parameters

| Name       | Type    | Required | Description                                                                                                                                                                                  |
| ---------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `from`     | string  | true     | The from address.                                                                                                                                                                            |
| `to`       | string  | true     | The to address. For multiple email addresses use a comma separated email string.                                                                                                             |
| `subject`  | string  | true     | The subject, can be HTML or plain text.                                                                                                                                                      |
| `body`     | string  | true     | This should be a string of HTML that defines the body, although you can use plain text if desired.                                                                                           |
| `cc`       | string  | false    | The cc address. For multiple email addresses use a comma separated email string.                                                                                                             |
| `bcc`      | string  | false    | The bcc address. For multiple email addresses use a comma separated email string.                                                                                                            |
| `admin_id` | numeric | false    | Allows you to specify which admin sent out the email. The system will validate the admin's level and their access to that project to ensure only authorized admins can be set as the sender. |

# Example

:::CodeblockTabs
```curl
curl -X POST "https://www.regpack.com/reg/api2/users/" \ 
     -H "Content-Type: application/json" \ 
     -H "Accept: application/json" \ 
     -H "Api-Id: 15263" \ 
     -H "Api-user: api_admin@regpacks.com" \ 
     -H "Api-Token: cd2e514f-7gab-3cde-62fg-51abcd4e7362" \ 
     -d '{
    "action": "add_email",
    "group_id": 100909072,
    "clogin_id": 102670540,
    "doc": {
        "email_list": {
            "from": "concert_venue@regpacks.com",
            "to": "miles_davis@regpacks.com",
            "subject": "Booking Confirmed",
            "body": "The Miles Davis Quintet is confirmed for Friday night at 8:00!"
        }
    }
}
```

```python
import requests
import json
users_endpoint = https://www.regpack.com/reg/api2/users/
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "Api-Id": "15263",
    "Api-user": "api_admin@regpacks.com",
    "Api-Token": "cd2e514f-7gab-3cde-62fg-51abcd4e7362",
}
payload = {
    "action": "add_email",
    "group_id": 100909072,
    "clogin_id": 102670540,
    "doc": {
        "email_list": {
            "from": "concert_venue@regpacks.com",
            "to": "miles_davis@regpacks.com",
            "subject": "Booking Confirmed",
            "body": "The Miles Davis Quintet is confirmed for Friday night at 8:00!"
        }
    }
}
add_email_json = json.dumps(payload)
add_email_response = requests.post(url=users_endpoint, 
                                   data=add_email_json, 
                                   headers=headers, 
                                   timeout=10)
```
:::



# Response

```json
{
    "msg": "Emails added successfully",
    "success": true,
    "user_info": {
        "clogin_id": "102670540",
        "group_id": "100909072",
        "connected_to": "102670540"
    },
    "meta_info": {
        "u_name": "Miles Davis",
        "total_forms": "2",
        "completed_forms": "0",
        "total_user_forms": "2",
        "total_completed_user_forms": "0",
        "total_user_mandatory_forms": "2",
        "total_completed_user_mandatory_forms": "0",
        "total_order": "0.00",
        "total_paid": "0.00",
        "total_balance": "0.00",
        "status_id": "0",
        "status_name": null,
        "status_color": null,
        "application_date": "Dec 8th 2021 17:20",
        "application_date_raw": "2021-12-08 17:20:08",
        "u_comments": "0",
        "group_id": "100909072",
        "uid": "4085258",
        "clogin_id": "102670540",
        "excluded": "0",
        "connected_to": "102670540",
        "total_user_tags": "0",
        "user_tag_ids": null,
        "total_non_excluded_children": "1",
        "star": "0",
        "admin_initials": null,
        "admin_color": null,
        "assigned_admin_id": null
    }
}
```



