Email AI Assistant

Chat with your favorite AI via email (with PDF attachment support)

What It Does

This script allows you to:

  • Send emails to OpenAI. The text will be treated as the prompt
  • Parse PDF attachments and include their contents in the AI's analysis.
  • Get response directly to your inbox.

Setup guide

  1. Copy this Val and save it as an Email Val (choose Val type in top-right corner of editor)

  2. Add your OpenAI API key to line 8 (or use an environment variable: https://docs.val.town/reference/environment-variables/)

  3. Copy the email address of the Val (click 3 dots in top-right > Copy > Copy email address)

  4. Write your email, include any attachments, and send it to the Val email address. The AI will respond after a few seconds.