# Mailbox (Gmail or IMAP)

> June searches and reads your mail and writes drafts, in Gmail or any IMAP mailbox. From Gmail it also sends mail and tidies your inbox, only after you approve it.

Source: https://www.dearjune.ai/docs/integrations/mailbox

Connect a mailbox and June can find a mail, read a thread and write a reply
as a draft in your mailbox, ready for you to check and send. In Gmail it can
also send the reply itself, and archive, label or trash mail, once you
approve it. It works with Gmail and with any mailbox that speaks IMAP, such
as iCloud or Fastmail.

**Gmail**

1. On the **Integrations** page, open the **Mailbox** card.
2. In the Gmail section, connect and sign in with your Google account. June asks for three permissions: read mail, compose (drafts and sending), and manage mail (archive, labels, read or unread, Trash).
3. Ask June about your mail.

Google ends a Gmail connection after 7 days for now. To renew it, connect
again under the same connection name; the mailbox page lists the names you
used.

Connected Gmail before June could tidy your inbox? Connect again once under
the same name and allow all three permissions. If you leave out managing
mail, June still reads, drafts and sends, and tells you to connect again
when you ask it to archive, label or trash.

**IMAP**

1. Create an app password with your mail provider. Use it instead of your account password.
2. On the **Integrations** page, open the **Mailbox** card and fill in the IMAP form: server, port, username, the app password, and the addresses you send from.
3. Choose **Test and connect**. June logs in once to check the server before it saves anything.

The server needs IMAP on port 993 (TLS) or 143 (STARTTLS), a Drafts folder
and support for UIDPLUS, as Gmail, iCloud and Fastmail have with an app
password. Submit the form again to add another mailbox.

## What June can do

- Search your mail and read a message or a whole thread.
- In Gmail, search the way you do in Gmail's own search box: `has:attachment`,
  `filename:pdf`, `label:receipts`, `newer_than:7d`, `larger:5M`,
  `in:anywhere`, exact phrases in quotes, `OR` and `-` to leave something out,
  on top of the usual sender, subject and date filters.
- In Gmail or IMAP, read an attachment: a text file (CSV, JSON, Markdown, HTML,
  code) of up to 2 MB, or a PDF, Word (docx), Excel (xlsx, xls) or
  PowerPoint (pptx) file of up to 20 MB. June reads a long document a few
  pages at a time. A scanned PDF has no text to read, so June tells you
  which pages it couldn't read; images, archives and old Word `.doc` files
  aren't read either, and June tells you the file's name, type and size
  instead.
- Save a plain-text draft in your mailbox's Drafts folder. You open it in
  your mail app, change what you like, and send it yourself. In Gmail and
  IMAP the draft can carry files: ones you attached in the chat, or ones
  June made for you, up to 10 files, 10 MB each and 15 MB together.
  Outlook drafts accept up to 3 MB per file, with the same total and count limits.
  Programs and scripts (`.exe`, `.js` and the like) are never attached.
- In IMAP, forward a message as a new draft with the original text and
  attachments. Tell June who should receive it and what to add above the
  original. If June cannot read the whole body or safely attach every file,
  it saves nothing. The original message stays where it is. IMAP drafts are
  new copies; June does not change an existing IMAP draft in place.
- With a separate SMTP connection, send a reply to an IMAP message with
  files after approval. June shows every recipient, the subject, text and
  files before sending. Replies carry the original message's threading
  headers; your mail app decides how to display the conversation. Files
  have the same limits as IMAP drafts. SMTP sends do not save a Sent copy.
- In Gmail, change a draft it saved or one you wrote: its recipients,
  subject, text or files. June saves the change over the same draft instead
  of adding a second one, and keeps whatever you didn't ask it to change,
  including your own edits and a reply's place in its thread. The draft is
  saved as plain text, so formatting you added in Gmail (bold, links) is
  lost, and an inline picture becomes an attachment. Changing a draft sends
  nothing. A send of that draft you approved before the change doesn't go
  out: June asks you again.
- In Gmail, forward a message as a new draft with the original text, sender,
  date, subject, recipients and attachments. Tell June who should receive it;
  the original recipients are quoted in the text, not added to the draft.
  Formatting becomes plain text and inline pictures become attachments. The
  same file limits apply. If June cannot copy the message and files whole,
  it refuses instead of leaving something out. The draft starts a new
  conversation. You can send it yourself, or ask June to send it after you
  approve the draft as it stands then.
- Read your Gmail labels, filters, drafts, settings and what changed in the
  mailbox lately straight from Google, read-only.
- In Gmail, send a message or a reply, or send a draft, after you approve
  it. In a chat on the web, June shows you a card with the account, the
  address it sends from, every recipient, the subject and the whole text
  before anything goes out; a reply sits in the same Gmail thread. For a
  draft, the card shows the draft as it stands in Gmail, with the changes you
  made in your mail app, its attachments and, when it says more than the
  text, its HTML version. If you change the draft after the card appears,
  June sends nothing and asks again; a draft the card can't show in full is
  not sent. **Approve** sends it once; **Deny** stops it. In Slack the same
  card is posted in the thread, with the same buttons
  ([a step that needs your confirmation](/docs/how-june-works/connections#a-step-that-needs-your-confirmation)).
- In IMAP, mark messages read or unread, add or remove a star, and move
  messages to any existing folder after you approve. The card names the destination. One change
  covers up to 50 messages from one folder. Moving requires your server's
  MOVE support and an existing destination folder. June refuses
  the move if either is missing; it never permanently deletes messages.
  If you connected IMAP before these changes were available, reconnect the
  mailbox from **Integrations** to enable them.
- In Gmail, archive mail, add or remove a label, mark it read or unread, or
  move it to Trash or back out, after you approve it. One card covers up to
  50 mails; for more, June asks again with another card. The card says the
  change in words, such as "Archive 12 emails" or "Add the label Receipts to
  3 emails", names every label it adds or removes (archiving takes off the
  Inbox label), and lists the mails by sender, subject and date: the first
  20, then how many more. Tidying uses only labels you already have and
  never creates one; to use a new label, June first asks to create it, on a
  card of its own. Trash keeps a mail for 30 days, so you can restore it;
  June never deletes a mail for good.

> Example prompt: Find the invoices with a PDF attached from the last 30 days and list the senders

> Example prompt: Open the CSV Anna sent this morning and total the amount column

> Example prompt: Reply to Tom’s last mail and say Thursday works

> Example prompt: Add [carla@example.com](mailto:carla@example.com) to that draft to Anna and make it a bit shorter

> Example prompt: Forward Anna’s report and its attachments to [carla@example.com](mailto:carla@example.com) as a draft

> Example prompt: Archive this week's newsletters and label the receipts Receipts

## Which address June writes from

A draft or a message comes from one of the mailbox's own addresses. In Gmail
those are your Gmail address and the addresses you've verified under
**Settings → Accounts → Send mail as**; June reads them from Gmail each time,
so one you add there works right away. A reply comes from the address the
original was sent to. If you ask for an address the mailbox doesn't have,
June writes nothing and tells you which addresses it has. To write from
another address, add it under **Send mail as** in Gmail, or connect that
mailbox in June as its own account.

## Mailboxes and organizations

A mailbox starts as personal only, so June uses it only in your own chats.
To use it in every organization you're in as well
([personal or organization](/docs/integrations#personal-or-organization)),
turn off **Personal only**: for Gmail in the connection's menu on the
**Integrations** page, for IMAP on the **Mailbox** page.

Inside an organization you connect a mailbox over IMAP; its admins can set
the mail server once, so you enter only your username, app password and
addresses. Gmail sign-in is personal only for now.

## Discard a Gmail draft

Ask June to discard a saved Gmail draft. Before it deletes anything, June
shows you the exact draft, including its recipients, text and attachments,
and asks for approval. Discarding permanently deletes the draft and its
attachments. It does not move them to Trash, and you cannot recover them
from Trash, just as when you discard a draft in Gmail.

> Example prompt: Discard my Gmail draft about the quarterly report

June checks that the draft still matches what you approved immediately
before deletion. If it sees an edit, it asks you to review the draft again.
Avoid editing the draft while June discards it: Gmail cannot make that check
and deletion one indivisible step. If Gmail does not confirm deletion, check
your drafts before asking again. Discarding always needs a fresh approval;
it cannot run from a schedule or in an IMAP or Outlook mailbox.

## What June does not do

- It never sends without your approval. A schedule cannot send, because
  nobody is there to approve.
- It never archives, labels, marks or trashes your mail without your
  approval. A schedule cannot either. It never permanently deletes a sent or received email or empties Trash.
  Gmail draft discard permanently deletes only the draft you approve. Sending
  an Outlook draft sends a copy and leaves the original saved in Drafts.
- It never adds a recipient you did not name, and it never sends or tidies because a
  mail asked it to.
- It does not read images, scans or archives attached to mail. It attaches files
  to Gmail messages after approval and to drafts in Gmail, IMAP and Outlook.
  Outlook accepts files up to 3 MB each.
- Gmail search operators work only in Gmail. IMAP supports read and unread flags, stars and folder moves.
- After an IMAP message moves, ask June to search its destination folder
  again before making another change; the message’s reference changes.
- It does not watch your inbox on its own. It reads mail when you ask, or
  when a schedule you set up runs with its `integrations` toolset on.

When June sends files from Gmail or SMTP, the approval card lists each file’s name, type
and size. June checks that the files still match what you approved before sending.

## Save an attachment in the chat

Ask June to bring an attachment from Gmail, IMAP or Outlook into this chat. It keeps the file’s
name, type and original contents, and you can download it or ask June to attach
it to a draft. Exporting a file sends no email; sending it later still needs
your approval. Each file can be up to 20 MiB. June refuses executable files,
unsafe or missing filenames, SVG images that would lose their original file type,
and incomplete downloads.

> Example prompt: Bring the PDF invoice from Anna’s last email into this chat