# Mailhook trigger

The mailhook trigger lets you trigger workflow runs when an email is received on a uniquely generated email address just for this workflow.

## When to use a mailhook trigger

You should use Mailhooks when you want to instantly trigger a workflow programmatically from another tool, but that tool (a) doesn't offer webhooks, and (b) Relay.app doesn't integrate with it yet.

#### Mailhooks vs. webhooks

Mailhooks are very much analogous to webhooks, in that they're typically system-generated. There are some tools that have their own automation features, and can automatically send an email when something happens, but not many of those same tools let you send an arbitrary HTTP request (meaning: you can't use a webhook trigger). If a webhook is available, you should use that, but if it's not available, a mailhook may be your best choice.

#### Mailhooks vs. a standard "Email received" trigger

For any mailhook trigger, you could also send those emails to your personal inbox and set up an Email Received trigger, but this is a much more deliberate (and less error-prone) way to accomplish that same end result without cluttering up your personal inbox. If your use case is to simply process all emails coming into your personal inbox with some light filtering, then the Gmail trigger is the way to go. But if you're working in a tool that sends emails programmatically, or you want to kick off runs only in very specific circumstances, the mailhook trigger is an easy way to set that up.

## Setting up a mailhook trigger

#### 1. Select 'Mailhook' from the trigger menu

<figure><img src="/files/FOEct30Xgm4nFo4HKztF" alt=""><figcaption></figcaption></figure>

#### 2. Specify who might send emails to the unique email address

By default, it's set to accept emails from **Any sender**. You can change this when desired.

<figure><img src="/files/nBqJFKyE2EUCdlCXCkb5" alt=""><figcaption></figcaption></figure>

## Step output

The [Step output](/data/step-outputs.md) of the Mailhook trigger contains

* The email's message **Body**
* The email's **Subject**
* The email address of the sender (**From**)
* A List of recipients of the email (**To**)
* A List of **CC**'d email addresses

## Size limitations

There is a 10 MB request size limit on mailhook triggers.

Because of the way mailhook requests are sent, rejections unfortunately will not come back to you in the form of a bounced message, so please be aware of this limit if you expect to receive messages with large attachments.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.relay.app/triggers/mailhook-trigger.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
