Files
twenty/packages/twenty-docs/user-guide/workflows/capabilities/send-emails-from-workflows.mdx
T
Charles BochetandGitHub da6f1bbef3 Rename serverlessFunction to logicFunction (#17494)
## Summary

Rename "Serverless Function" to "Logic Function" across the codebase for
clearer naming.

### Environment Variable Changes

| Old | New |
|-----|-----|
| `SERVERLESS_TYPE` | `LOGIC_FUNCTION_TYPE` |
| `SERVERLESS_LAMBDA_REGION` | `LOGIC_FUNCTION_LAMBDA_REGION` |
| `SERVERLESS_LAMBDA_ROLE` | `LOGIC_FUNCTION_LAMBDA_ROLE` |
| `SERVERLESS_LAMBDA_SUBHOSTING_URL` |
`LOGIC_FUNCTION_LAMBDA_SUBHOSTING_URL` |
| `SERVERLESS_LAMBDA_ACCESS_KEY_ID` |
`LOGIC_FUNCTION_LAMBDA_ACCESS_KEY_ID` |
| `SERVERLESS_LAMBDA_SECRET_ACCESS_KEY` |
`LOGIC_FUNCTION_LAMBDA_SECRET_ACCESS_KEY` |

### Breaking Changes

- Environment variables must be updated in production deployments
- Database migration renames `serverlessFunction` → `logicFunction`
tables
2026-01-28 01:42:19 +01:00

165 lines
4.7 KiB
Plaintext

---
title: Send Emails from Workflows
description: Send personalized emails automatically using workflow actions.
image: /images/user-guide/workflows/workflow.png
---
Automatically send emails when specific events occur in your CRM—welcome new contacts, follow up on opportunities, or notify team members.
## Prerequisites
Before you can send emails from workflows:
1. Connect an email account under **Settings → Accounts**
2. Ensure the account has sending permissions enabled
## Basic Email Workflow
### Example: Welcome Email for New Contacts
**Goal**: Send a welcome email when a new person is added to the CRM.
**Setup**:
1. **Create workflow**: Go to **Settings → Workflows** and click **+ New Workflow**
2. **Add trigger**: Select **Record is Created** → **People**
3. **Add Send Email action**:
- Click **+** to add an action
- Select **Send Email**
- Configure the email:
| Field | Value |
|-------|-------|
| **To** | `{{trigger.object.email}}` |
| **Subject** | `Welcome to {{Your Company Name}}` |
| **Body** | `Hi {{trigger.object.firstName}}, ...` |
4. **Test and activate**: Test with a sample record, then activate
## Using Variables in Emails
Reference data from previous steps using `{{variable}}` syntax:
```text
Hi {{trigger.object.firstName}},
Thank you for connecting with us!
Your company, {{trigger.object.company.name}}, is now in our system.
Best regards,
The Team
```
### Available Variables from Triggers
| Trigger Type | Common Variables |
|--------------|------------------|
| **Record Created/Updated** | `{{trigger.object.fieldName}}` |
| **Manual** | `{{trigger.selectedRecord.fieldName}}` |
| **Webhook** | `{{trigger.body.fieldName}}` |
## Advanced: Conditional Emails
### Example: Different Emails Based on Lead Source
**Goal**: Send different welcome emails based on where the lead came from.
**Setup**:
1. **Trigger**: Record is Created (People)
2. **Add Filter action**:
- Condition: `{{trigger.object.source}}` equals `"Website"`
- If true → continue to website welcome email
3. **Branch for other sources**:
- Create parallel branches for different sources
- Each branch has its own Send Email action
## Sending Emails to Multiple Recipients
### Example: Notify Team When Deal Closes
**Goal**: Email the sales rep and their manager when an opportunity is won.
**Setup**:
1. **Trigger**: Record is Updated (Opportunities, Stage = "Closed Won")
2. **Search Records**: Find the opportunity owner's manager
3. **Send Email #1**: To opportunity owner
- To: `{{trigger.object.owner.email}}`
- Subject: `Congratulations on closing {{trigger.object.name}}!`
4. **Send Email #2**: To manager
- To: `{{searchRecords.manager.email}}`
- Subject: `Deal Won: {{trigger.object.name}}`
## Scheduled Follow-up Emails
### Example: Follow Up 3 Days After Meeting
**Goal**: Send a follow-up email 3 days after a meeting is logged.
**Setup**:
1. **Trigger**: Record is Created (Activities, Type = "Meeting")
2. **Delay action**: Wait 3 days
3. **Send Email**:
- To: Meeting attendee
- Subject: Following up on our conversation
- Body: Reference meeting details from trigger
## Email Attachments
You can attach files to emails sent from workflows. The attachment is a static file that you upload when configuring the workflow.
### How to Add an Attachment
1. In the **Send Email** action, click on the **Attachments** button
2. Click to upload a file from your computer
3. The file will be attached to all emails sent by this action
### Common Use Cases
| Use Case | Example File |
|----------|--------------|
| **Welcome emails** | Company brochure (PDF) |
| **Onboarding sequences** | Getting started guide |
| **Sales follow-ups** | Product catalog or price list |
| **Event confirmations** | Event details or agenda |
<Note>
Attachments are static—the same file is sent to all recipients. For dynamic documents (like personalized quotes), generate and attach files using a [Logic Function](/user-guide/workflows/how-tos/connect-to-other-tools/generate-pdf-from-twenty).
</Note>
## Best Practices
### Email Content
- Keep subject lines concise and relevant
- Personalize with recipient's name
- Include a clear call to action
- Test emails before activating
### Deliverability
- Don't send too many emails too quickly
- Use professional email signatures
- Avoid spam trigger words
- Ensure unsubscribe options for marketing emails
### Troubleshooting
- Verify email account is connected and active
- Check recipient email address is valid
- Review workflow runs for error messages
- Test with your own email address first
## Related
- [Workflow Triggers](/user-guide/workflows/capabilities/workflow-triggers)
- [Workflow Actions](/user-guide/workflows/capabilities/workflow-actions)