# Send email from inside custom code action

**URL:** <https://community.hubspot.com/t/send-email-from-inside-custom-code-action/34064>\
**Category:** CMS Development\
**Tags:** javascript\
**Created:** [March 17, 2021, 9:28pm UTC](https://community.hubspot.com/t/send-email-from-inside-custom-code-action/34064 "2021-03-17T21:28:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgranados](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jgranados/32/82797_2.png) [@jgranados](https://community.hubspot.com/u/jgranados)\
**Post date:** [March 17, 2021, 9:28pm UTC](https://community.hubspot.com/t/send-email-from-inside-custom-code-action/34064/1 "2021-03-17T21:28:49Z")

</div>

Hello,

We created a custom code action which is used in different workflows in our production environment. Every time this scripts fails we want to notify some users at HubSpot about it. Is there a notification mechanism we can use for it from inside a custom code action? Can we send email messages from inside a custom code action?

Thanks in advance for your help with this!

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [March 18, 2021, 5:02pm UTC](https://community.hubspot.com/t/send-email-from-inside-custom-code-action/34064/2 "2021-03-18T17:02:55Z")

</div>

Hello @jgranados .

Throwing @kierana at this for some of his sage advice 😀

---

<div class="post-metadata">

**Author:** ![jgranados](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jgranados/32/82797_2.png) [@jgranados](https://community.hubspot.com/u/jgranados)\
**Post date:** [March 22, 2021, 9:49pm UTC](https://community.hubspot.com/t/send-email-from-inside-custom-code-action/34064/3 "2021-03-22T21:49:37Z")

</div>

We implemented a workaround by creating and connecting to an external service which sends the email. I have created an “idea” suggesting HubSpot to allow using AWS S3 SES from inside the custom code actions in order to send emails: [https://community.hubspot.com/t5/HubSpot-Ideas/Send-email-from-inside-custom-code-action/idi-p/420927#M78142](https://community.hubspot.com/t5/HubSpot-Ideas/Send-email-from-inside-custom-code-action/idi-p/420927#M78142)

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [March 23, 2021, 3:00pm UTC](https://community.hubspot.com/t/send-email-from-inside-custom-code-action/34064/4 "2021-03-23T15:00:36Z")

</div>

Cosnider it upvoted 👍

---

<div class="post-metadata">

**Author:** ![CP-BWG](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/cp-bwg/32/87988_2.png) [@CP-BWG](https://community.hubspot.com/u/CP-BWG)\
**Post date:** [July 29, 2022, 9:34pm UTC](https://community.hubspot.com/t/send-email-from-inside-custom-code-action/34064/5 "2022-07-29T21:34:37Z")

</div>

@jgranados ming sharing a screenshot? I haven’t be able to find a way to do it in a workflow - they do not have ability to select the code execution result as an if/then branch. We have tried to do things like create a custom property, set that property with the copy value function, then trigger… but what a hassle. You just doing it inside the code as another API call?

---

<div class="post-metadata">

**Author:** ![MeganLegge](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/meganlegge/32/20466_2.png) [@MeganLegge](https://community.hubspot.com/u/MeganLegge)\
**Post date:** [April 21, 2021, 5:28pm UTC](https://community.hubspot.com/t/send-email-from-inside-custom-code-action/34064/6 "2021-04-21T17:28:37Z")

</div>

Hi @jgranados ,

My name is Megan and I’m a product manager for the workflows tool. Your post caught my attention, because we’ve just launched a new type of branch in workflows, that lets you branch on outputs from previous workflow actions, called Simple Branch. This means, you could add your own unique outputs to your custom code action for error handling, and/or leverage our default action output for the success/fail state of an action. You could use this branching to split off the workflow and go to a notification action next, if there’s a failure. If you’d like to check this feature out and don’t yet have access, please send me a message with your HubID and I’d be glad to have you try it out and give feedback.

Best,

Megan
