# Mail intake bot - ops handover Version: none shown by the bot (code as of commit 07255fa) · Written 2026-10-23 · Escalation: raise a ticket in the **RPA Support** queue ## 1. What the bot does Every 10 minutes, Windows Task Scheduler starts the bot. It reads the **unread** emails in the referrals mailbox and saves every attachment. It checks that each attachment is a PDF under 20 MB, then copies it into the **shared intake folder**. That folder is the only output, and the only place ops can see. The bot keeps an internal queue with a status and a note for every attachment. Ops cannot open that queue or the bot's log (see section 5). The bot drives no desktop apps or websites, so no windows need to be left alone. It talks only to the mailbox and the shared folder. ## 2. How it works ``` Windows Task Scheduler (every 10 min) └─ starts → Mail intake bot ──reads──> Referrals mailbox (unread mail only) │ ├─ saves attachments → the bot's own temp folder ├─ copies good PDFs → Shared intake folder ← ops can see this ├─ writes → internal queue (status + note per attachment) ← ops cannot see └─ writes → bot log file ← ops cannot see ``` - **Task Scheduler** starts the bot every 10 minutes. The bot has no window and no screen. - **Referrals mailbox:** the bot signs in and takes every unread email. When it reads an email, the mailbox marks it as read. - **Temp folder:** every attachment lands here first. Rejected or failed files **stay here**, not in the intake folder. - **Shared intake folder:** only PDFs that passed the checks and copied correctly end up here. - **Internal queue and log:** they hold the status, the reason and the time of each item. Only the dev team can open them today. **One run, step by step:** 1. If an item from an earlier run is still marked "Processing", the bot **stops straight away** and does nothing more in this run (see E01). 2. It signs in to the mailbox. If that fails, it tries up to 3 times, 30 seconds apart. 3. It takes all unread emails, saves every attachment to the temp folder and adds each one to the queue as "New". 4. For each New item: it marks the item Processing, checks the file, copies it to the intake folder, then sets the item's final status and note. ## 3. Before a run Ops cannot check these items. The dev team sets them up. They are listed here so ops knows what a "nothing arrives" ticket can be about. - [ ] (Dev) The bot's settings file has the mailbox address, user and password, and the intake folder location. If one is missing, every run crashes at start and writes **nothing** to the log. - [ ] (Dev) The bot's data folder holds the queue and a temp folder. On the current machine the data folder is empty, so the first run would crash. - [ ] (Dev) The mailbox password has not expired. An expired password stops all intake (E02). - [ ] (Dev) The scheduled task is enabled and runs every 10 minutes. - [ ] Rules for referral senders, which ops can pass on: - Send each referral as a **PDF**, **under 20 MB**, **without a password**. - Bad: `referral.docx`, a 35 MB scan, a password-protected PDF. Good: `referral.pdf`, 3 MB, opens without a password. - Give every file a **unique name**. Two attachments with the same name overwrite each other (E06). - Bad: two emails that both attach `scan.pdf`. Good: `scan__.pdf`. - Logos and pictures in an email signature also count as attachments. They are rejected as "not a PDF", which is harmless. ## 4. During a run - There is nothing to watch. The bot has no window. - **Do not mark emails in the referrals mailbox as read.** The bot only picks up unread mail. An email marked read by hand is never processed. - **Do not move, rename or open-and-lock files in the intake folder while they are being copied.** - To stop the bot: ops cannot. Raise an RPA Support ticket and ask the dev team to **disable the scheduled task between runs**. Never end the bot in the middle of a run. A run killed halfway leaves an item in "Processing", and that blocks every later run (E01). - How a stuck bot looks: **no new files arrive in the intake folder for more than 30 minutes while referrals are being sent.** The bot does not restart itself and has no stuck-run limit. It stays blocked until the dev team acts, so raise a ticket straight away. ## 5. Where to look when something goes wrong Ops can open the shared intake folder and nothing else. The bot has no screen or report of its own. Most answers are therefore "raise a ticket". Section 13 lists the gaps for the dev team. | Question | Where to look | |---|---| | Did the run finish? | Ops cannot see this. The only sign is new files in the intake folder, sorted by date modified. | | Is the bot working at all? | Intake folder: was the newest file added in the last 30 minutes (during hours when referrals come in)? If not, raise a ticket. | | Did a particular referral arrive? | Intake folder: look for the attachment's file name. If it is missing, raise a ticket with the email's received time. | | Why did one item fail? | Ops cannot see this. The status and note are only in the bot's queue and log. Raise a ticket. | | Did the bot already retry? | It only retries signing in to the mailbox (3 tries, 30 seconds apart, every run). Nothing else is retried (section 8). | | Which version is running? | Not shown anywhere (section 10). | ## 6. Statuses The bot gives every attachment one status and one note. **No screen shows them to ops and they have no colour.** Only the dev team can read them. They are listed so ops and dev use the same words in a ticket. | Status | Note written | Colour | Meaning | What ops does | |---|---|---|---|---| | New | (empty) | none (not shown) | Saved from the mailbox, waiting for this run's checks | nothing | | Processing | (empty) | none (not shown) | Being checked and copied right now. **If it is still there after the run, it blocks every later run.** | Ticket if no new files arrive for 30 minutes (E01) | | Done | " pages saved" | none (not shown) | PDF copied to the intake folder | nothing | | Done | "encrypted - not readable" | none (not shown) | **Needs follow-up.** A password-protected PDF. It was **not** copied to the intake folder, even though the status says Done. | Ask the sender to resend it without a password (E05) | | Quarantined | "not a PDF or over 20 MB" | none (not shown) | Rejected. It stays in the bot's temp folder and is not copied. | Ask the sender to resend it as a PDF under 20 MB (E04) | | Failed | "share unreachable: " | none (not shown) | The intake folder could not be reached. **Never retried.** | Ticket. The dev team must re-queue it (E03). | ## 7. Exception catalogue Ops sees most of these the same way: **a file is missing from the intake folder.** Quote the E-number in the ticket when you know it. When you don't, say "no new files since