> For the complete documentation index, see [llms.txt](https://docs.puppetry.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.puppetry.app/master/testing-emails/example-with-....md).

# Example with Mailinator

Similar to [Restmail.net](http://restmail.net/) we need user name alias to use with the REST API. so we modify the first steps in the case case as follows:

![Assigning TEST\_USER\_ALIAS and TEST\_EMAIL](/files/-LiIyYpg-JJw8k2sPpTA)

Following [Mailinator API](https://manybrain.github.io/m8rdocs/#message-api) we need to set URL for `page.assignVarRemotely`:

```
https://api.mailinator.com/api/inbox?token={{ env( "EID_SECRET" ) }}&to={{ TEST_USER_ALIAS }}
```

![page.assignVarRemotely configuration for Mailinator (part 1)](/files/-LiIzsEM_hNQomumkFPz)

However [Mailinator](https://www.mailinator.com/) unlike [Restmail.net](http://restmail.net/)  doesn't allow to receive last message content with a single request. So we need to take advantage of optional `request function` command parameter:

So we alternate the default fetch logic of `page.assignVarRemotely` as follows:

```javascript
async ( url ) => {
   const inbox = await ( await fetch( url ) ).json(),
         msgHead = inbox.messages
           .reverse()
           .find( msg => msg.subject.includes( "Account Validation" ) ),
         fulMsg = await ( await fetch( `https://api.mailinator.com/api/message?token=YourAPIToken&id=${ msgHead.id }` ) ).json();
  return fulMsg.data.parts.map( p => p.body ).join();
}
```

Thus the command will read the listing and find a message with subject containing `"Account Validation"` string. Then it retrieves and returns the raw body of the matching mail. So the parse function may look like:

```javascript
( text ) => {
    const re = /(http\:[^\"]+4567\/con[^\"]+)/g,
              res = text.match( re );
    return res ? res[ 0 ].replace( "=\r\n", "" ) : null;
}
```

![page.assignVarRemotely configuration for Mailinator (part 2)](/files/-LiJ-iBkOEomJK7TUkzr)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.puppetry.app/master/testing-emails/example-with-....md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
