# Send basic emails using API

**URL:** <https://community.hubspot.com/t/send-basic-emails-using-api/105583>\
**Category:** APIs & Integrations\
**Tags:** email\
**Created:** [April 23, 2024, 5:36pm UTC](https://community.hubspot.com/t/send-basic-emails-using-api/105583 "2024-04-23T17:36:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MDrapeau](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@MDrapeau](https://community.hubspot.com/u/MDrapeau)\
**Post date:** [April 23, 2024, 5:36pm UTC](https://community.hubspot.com/t/send-basic-emails-using-api/105583/1 "2024-04-23T17:36:25Z")

</div>

Given that we have access to the transactional email scope, how can we use the API to send HTML/text emails without templates?

```lia-code-sample
import time
from hubspot import HubSpot
from hubspot.marketing.transactional import PublicSingleSendRequestEgg

api_client = HubSpot(access_token='ABC')

message = {
 "from": "sender@origin.com",
 "to": "user@example.com"
}
public_single_send_request_egg = PublicSingleSendRequestEgg(email_id=int(time.time()), message=message)
 api_client.marketing.transactional.single_send_api.send_email(public_single_send_request_egg=public_single_send_request_egg)

```

Where do we provide the email subject and email body (HTML or text)? Since the body content change constantly, it is impossible to create pre-defined templates.

---

<div class="post-metadata">

**Author:** ![Humashankar](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/humashankar/32/30856_2.png) [@Humashankar](https://community.hubspot.com/u/Humashankar)\
**Post date:** [April 23, 2024, 11:40pm UTC](https://community.hubspot.com/t/send-basic-emails-using-api/105583/2 "2024-04-23T23:40:56Z")

</div>

**Hi @MDrapeau**

**Looks your code is missing a crucial element for sending emails with dynamic content - the actual body content (HTML or text)**

**Here is a sample.**

**message = {**

```
**"from": "sender@origin.com",**

**"to": "user@example.com",**

**"subject": "Your Dynamic Email Subject", # Update with your subject line**

**"html": "\<h1>This is the HTML content of your email.\</h1>" # Update with your HTML content**

**# OR**

**"text": "This is the plain text content of your email." # Update with your plain text content (optional)**

```

**}**

**Hope this helps - Happy to help further!!**  
**Thank you very much and have a great one!**  
**Warm regards**

---

<div class="post-metadata">

**Author:** ![MDrapeau](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@MDrapeau](https://community.hubspot.com/u/MDrapeau)\
**Post date:** [April 24, 2024, 3:22pm UTC](https://community.hubspot.com/t/send-basic-emails-using-api/105583/3 "2024-04-24T15:22:38Z")

</div>

Creating a “skeleton” in the UI without a subject is not possible.

Also, html does not seem to be added in the body of emails being sent.

How to bypass this limitation?

---

<div class="post-metadata">

**Author:** ![JEdwards71](https://avatars.discourse-cdn.com/v4/letter/j/8c91f0/32.png) [@JEdwards71](https://community.hubspot.com/u/JEdwards71)\
**Post date:** [April 1, 2025, 7:58am UTC](https://community.hubspot.com/t/send-basic-emails-using-api/105583/4 "2025-04-01T07:58:48Z")

</div>

If you’re just looking to send simple, transactional-style emails via the HubSpot API, the most straightforward option is using the Single-send API with a regular email template. It’s not designed for bulk or marketing emails, but it works well for basic messages like confirmations or follow-ups. You’ll need to create and publish the email in HubSpot first, then trigger it using the API with the contact’s email and any personalization tokens. Just make sure the email is marked as “for automation” so it can be used this way.
