Send Email from a SQL Query but send only when result is not null

Hey can somebody explain how i can use the send SMTP node to send only mail when the result of a sql query is other then null?

running n8n (version: 1.65.2) on docker with these commands.

services:
n8n:
image: n8nio/n8n
container_name: n8n
restart: always
ports:
- “5678:5678”
environment:
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=user
- N8N_BASIC_AUTH_PASSWORD=xxxx
- WEBHOOK_URL=xxxx
volumes:
- ./n8n_data:/home/node/.n8n

volumes:
n8n_data:

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Welcome to the community @sf4692 !

Tip for sharing information

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

That implies to any JSON output you would like to share with us.

Make sure that you have removed any sensitive information from your workflow and include dummy or pinned data with it!


You can add Filter node in between SQL output and SMTP node. The conditions allow you to state “exist”, “is not empty”, etc, depending on the structure of the data.

1 Like

thank you very much thats it!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.