Forwards each new Gmail email that mentions one of your keywords to the address you choose, as soon as it arrives.

UsesGmail

Forward emails that mention a keyword

Whenever a new email arrives in your Gmail inbox, the workflow looks for the words or phrases you choose in its subject and body. When one turns up, the email is forwarded from your Gmail account to the address you picked, opening with a line that names the keyword it matched, followed by the original sender, date, subject and recipients.

Matching ignores case, and you can limit it to the subject line for a stricter filter. Emails that mention none of your keywords are left alone. A copy the workflow forwarded is recognized and never forwarded again, so sending to your own address is safe. You can also narrow the trigger to one sender or domain so the workflow only looks at mail from there.

The forward is plain text: an email that only has an HTML version is converted to readable text, a very long one is cut with a note saying so, and attachments are not carried over.

GmailGmailWhen an email arrives. Save it as email.When an email arrives. Save it as email.
Set forwardTo to blank.Set forwardTo to blank.
Set keywords to an empty list.Set keywords to an empty list.
Set searchBody to true.Set searchBody to true.
Run Python code on keywords, subject, sender, recipients, and date and save it as tidy.Run Python code on keywords, subject, sender, recipients, and date and save it as tidy.
If tidy.keywords is emptyIf tidy.keywords is empty
Yes
Stop and report a problem: Add at least one word or phrase to 'keywords' at the top of this workflow, such as 'invoice', then run it again. An email is forwarded when it mentions any one of them.Stop and report a problem: Add at least one word or phrase to 'keywords' at the top of this workflow, such as 'invoice', then run it again. An email is forwarded when it mentions any one of them.
No
No steps
Set readableBody to blank.Set readableBody to blank.
Set bodyToSearch to blank.Set bodyToSearch to blank.
If a step below fails, save the error as bodyErrorIf a step below fails, save the error as bodyError
Try
Run Python code on body and full_length and save it as converted.Run Python code on body and full_length and save it as converted.
Change readableBody to converted.text.Change readableBody to converted.text.
Change bodyToSearch to converted.text.Change bodyToSearch to converted.text.
On error
Change readableBody to “[This email's body could not be included here: it is too large or could not be turned into text. Open the original in Gmail to read it.]”.Change readableBody to “[This email's body could not be included here: it is too large or could not be turned into text. Open the original in Gmail to read it.]”.
Change bodyToSearch to email.body.Change bodyToSearch to email.body.
Build the text “@tidy.subject @bodyToSearch” and save it as searchedText.Build the text “@tidy.subject @bodyToSearch” and save it as searchedText.
If searchedText contains “Forwarded automatically because it mentions ”"If searchedText contains “Forwarded automatically because it mentions ”"
Yes
Finish the run: Skipped: this is a copy this workflow already forwarded, so it is not forwarded again.Finish the run: Skipped: this is a copy this workflow already forwarded, so it is not forwarded again.
No
No steps
If searchBody is noIf searchBody is no
Yes
Change searchedText to tidy.subject.Change searchedText to tidy.subject.
No
No steps
Set matchedKeyword to blank.Set matchedKeyword to blank.
For each keyword in tidy.keywords:For each keyword in tidy.keywords:
Trim keyword and save it as term.Trim keyword and save it as term.
If term isn't blank and searchedText contains term (ignoring case)If term isn't blank and searchedText contains term (ignoring case)
Yes
Change matchedKeyword to term.Change matchedKeyword to term.
Stop repeating.Stop repeating.
No
No steps
If matchedKeyword is blankIf matchedKeyword is blank
Yes
Finish the run: Skipped: this email does not mention any of your keywords.Finish the run: Skipped: this email does not mention any of your keywords.
No
No steps
GmailGmailSend an email to forwardTo. Save it as forwarded.Send an email to forwardTo. Save it as forwarded. Subject: Fwd: tidy.subjectForwarded automatically because it mentions "@matchedKeyword". ---------- Forwarded message --------- From: tidy.from Date: tidy.date Subject: tidy.subject To: tidy.to ...