Gmail Message
Gmail Message connects your flow to your Gmail mailbox to work with individual emails: send a new email (or save it as a draft), read the latest emails in a label, reply to an email, change its labels, mark it as read or unread, and delete it.
It is useful when email is part of a process: notices that go out on their own, customer emails that an AI agent reads and answers, or invoices that arrive by email and need processing.
When to use it
- You want to send a customer a confirmation email, with a document attached, at the end of a flow.
- Every morning you want to read the unread emails in your inbox and have an agent summarise them.
- An AI agent handles email enquiries and needs to reply in the same thread.
- You want to archive or label a supplier’s emails after processing them.
- You need to download the attachments of emails that arrive with invoices and extract their text.
Configuration
You need a Google Gmail credential, which connects by signing in with your Google account. To send, reply to, label, mark or delete emails, the credential needs the Create, Update, Delete, Read access; with Read Only you can only read. See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The Google Gmail credential of the account you work with. |
| Operation | What the component does. See Operations. Default: Send Message. |
| Recipient | Only in Send Message. The recipient’s email address. Required. |
| Subject | Only in Send Message. The email subject. Required. |
| Body | Only in Send Message. The email text. Required. If you write it in HTML, the email is sent with formatting. |
| Attachments | Only in Send Message. The files to attach. Connect a component that provides files here, or a link to a file. |
| Save as draft. | Only in Send Message. When on, the email is saved in Drafts instead of being sent. |
| Email Id. | The ID of the email you work with. Required in Reply Message, Update Message Label, Realize Message Marks and Delete Message. Optional in Get Message: if you fill it in, only that email is returned. |
| Reply Text | Only in Reply Message. The text of the reply. Required. |
| Number of Emails to read | Only in Get Message. How many emails to read, starting with the most recent. Default: 10. |
| Labels | In Get Message, the label to read emails from (for example INBOX for the inbox). In Update Message Label, the labels to add, remove or set. The list loads with your account’s labels when you choose the credential. |
| Select Action | Only in Update Message Label. Add adds the chosen labels, Remove removes them and Replace removes every label the email has and sets only the chosen ones. Default: Add. |
| Select Mark | Only in Realize Message Marks. Read marks the email as read and Unread as unread. Default: Read. |
Operations
| Operation | What it does |
|---|---|
Send Message | Sends a new email, or saves it as a draft if you turn on Save as draft. |
Get Message | Reads the latest emails in a label, with their text, sender, recipients, subject and date. |
Reply Message | Replies to the sender of an email, in the same thread and with the subject prefixed by Re:. |
Update Message Label | Adds, removes or replaces the labels of an email. |
Realize Message Marks | Marks an email as read or unread. |
Delete Message | Deletes an email permanently, without going through the trash. |
Advanced options
Only in Get Message:
| Field | What it does |
|---|---|
| Query | Filters emails with the same search you would use in Gmail, for example from:invoices@supplier.com, is:unread or has:attachment. |
| Fetch Attachments | Downloads the attachments of the emails read. Default: off. |
| Process Attachments | Requires Fetch Attachments. Extracts the text of attachments, for example from a PDF or a Word document. Default: off. |
| Enable OCR | Requires Fetch Attachments. Reads the text shown in attached images, for example a photo of a receipt. Default: off. |
Output
The Data output depends on the operation:
- In
Get Message, one item per email, with the email text, the sender (sender), the recipients (toandcc), the subject (subject), the date in day/month/year format, the ID of the email (id) and of its thread (thread_id), a short summary (snippet), its labels and, if you asked for them, the attachments. - In
Send Message, the details of the sent email or the draft, with its ID. - In
Reply Message,Update Message LabelandRealize Message Marks, the details of the email after the change. - In
Delete Message, a confirmation.
You can connect the result to an AI agent so it summarises or answers the emails, or to another component that stores the data, for example in a spreadsheet. The component can also be connected to an Agent as a tool, so the agent decides when to read or send emails. See Tool Mode.
Example
A training school wants to send the timetable to every student who enrols.
- The enrolment form reaches the flow with the student’s name and email.
- Add Gmail Message with the
Send Messageoperation. - In Recipient put the student’s email, in Subject
Your class timetableand in Body a greeting with their name. - Connect the component that provides the timetable PDF to Attachments.
- Run the flow with a test enrolment and check that the email arrives.
Good practices
- The email text returned by
Get Messagecomes from the plain-text version. If an email only has a formatted version, the text may be empty; the short summary (snippet) always comes through. - In
Get Message, Email Id. only finds the email if it is among the ones read with Number of Emails to read, Labels and Query. If you are looking for an old one, widen the search. Replacein Select Action also removes theINBOXlabel, so the email leaves the inbox. UseAddorRemoveif you only want to change one label.Delete Messagecannot be undone. If you prefer to be able to recover the email, use theTrash Threadoperation of Gmail Thread.
Related components
- Gmail Thread: work with whole conversations.
- Gmail Label: create and delete labels.
- Gmail Webhook: start a flow when an email arrives.