Ver Fonte

docs: the SMTP port block is the PROVIDER's, confirmed on a second droplet - and writing the send yourself does not escape it

fszontagh há 1 mês atrás
pai
commit
6c69762575
2 ficheiros alterados com 1 adições e 2 exclusões
  1. 0 1
      CLAUDE.md
  2. 1 1
      api/llms.txt

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 1
CLAUDE.md


+ 1 - 1
api/llms.txt

@@ -299,7 +299,7 @@ export default async function (ctx) {
   - **`criteria` is a structured object, never raw IMAP syntax** - the only string accepted is `'ALL'` (the default). Fields: `since`, `before`, `from`, `to`, `subject`, `text`, `body`, `headerName`+`headerValue`, `unseen`, `seen`, `flagged`, `largerThanBytes`, `smallerThanBytes`. `headerName` and `headerValue` are one criterion in two halves and must both be given, because a server answers a half-stated one with a syntax error rather than with a match. **A non-ASCII criterion value is REFUSED** (naming the field): expressing it needs a multi-step `CHARSET UTF-8` literal exchange this transport does not drive, and sending the bytes anyway makes the server match nothing - and zero results is indistinguishable from "there is no such mail", which is a silently wrong answer rather than a missing feature. Filter on an ASCII-safe criterion, or on sender or date, and match accented text yourself after fetching. Mailbox NAMES are unaffected and may be non-ASCII.
   - `ctx.mail.mailboxes({...})` -> `[{name, nameEncoding, flags, delimiter}]`. Names are decoded from IMAP's modified UTF-7, so `Beérkezett` arrives readable.
   - `ctx.mail.send({from, to, cc, bcc, subject, text, html, attachments, replyTo, headers, inReplyTo, references, ...})` -> `{ok: true, accepted: [...]}`. `to`/`cc`/`bcc` take a string or an array. Structure is chosen for you: text only is `text/plain`, text plus `html` is `multipart/alternative`, and attachments wrap it in `multipart/mixed`. Attachments are `{filename, contentType, base64}`. **`bcc` recipients receive the message but appear in no header of it.** A non-ASCII subject, display name or filename is encoded correctly (RFC 2047, and RFC 2231 for filenames). An address, subject, filename or header containing CR or LF is **refused by name** - that is header injection.
-  - **CHECK WHICH SMTP PORT YOUR HOST ALLOWS BEFORE WRITING THE FUNCTION. On a DigitalOcean droplet, outbound 25, 465 and 587 are BLOCKED by the provider and 2525 is open.** Measured on ours, and confirmed as the host's policy rather than any mail server's by `smtp.gmail.com:587` and `smtp.sendgrid.net:587` being blocked identically. A send on a blocked port fails as `mail_timeout` **504** after about 7 seconds with `retryable: false` - which is the correct answer and reads exactly like a wrong credential or a dead server, so it is the hardest failure here to diagnose from the error alone. A send over **2525 with STARTTLS works**, verified end to end through the deployed runner (accepted in ~1.3 s, then found by `UID SEARCH` and fetched back). IMAP 993 and 143 are unaffected and open. So **confirm your provider offers 2525** before building, and remember this is a property of the HOST your runner sits on rather than of this API.
+  - **CHECK WHICH SMTP PORT YOUR HOST ALLOWS BEFORE WRITING THE FUNCTION. On a DigitalOcean droplet, outbound 25, 465 and 587 are BLOCKED by the provider and 2525 is open.** Measured on ours, and confirmed as the host's policy rather than any mail server's by `smtp.gmail.com:587` and `smtp.sendgrid.net:587` being blocked identically. **CONFIRMED INDEPENDENTLY ON A SECOND, UNRELATED DROPLET**, which is what makes this a property of the host rather than of our box: a consumer measured 25, 465 and 587 blocked to both gmail and sendgrid from their own droplet, with `api.openai.com:443` open as a control and **`smtp.sendgrid.net:2525` OPEN**. **THE COROLLARY THAT MATTERS MORE THAN THE RULE: moving the send out of `ctx.mail` into your own service does NOT escape this.** Both are SMTP from the same host, so nodemailer on your own droplet hits the identical wall and fails the identical way - a seven-second timeout that reads like a wrong credential. The constraint is the PORT, not this API, so "write it myself instead" is not a workaround. And because one provider on 2525 was measured open, a provider that offers no 2525 does not make SMTP impossible either - it makes it a question of WHICH relay, not of whether to use SMTP at all. A send on a blocked port fails as `mail_timeout` **504** after about 7 seconds with `retryable: false` - which is the correct answer and reads exactly like a wrong credential or a dead server, so it is the hardest failure here to diagnose from the error alone. A send over **2525 with STARTTLS works**, verified end to end through the deployed runner (accepted in ~1.3 s, then found by `UID SEARCH` and fetched back). IMAP 993 and 143 are unaffected and open. So **confirm your provider offers 2525** before building, and remember this is a property of the HOST your runner sits on rather than of this API.
   - **The sending ACCOUNT is per call, and there is no project-level mailbox or default account.** `host`, `port`, `user`/`userSecret` and `password`/`passwordSecret` are options on every one of the three calls. That is deliberate and it matters when the mailbox and the data have different owners: a function running for a customer's project can send from YOUR OWN identity without the customer's mail system being involved at all, and nothing about the project binds the sender. A consumer sent internal commercial figures through a mailbox living inside their customer's tenant, where the customer's administrator could read them in the Sent folder; the remedy is simply to pass your own connection fields.
   - **There is NO idempotency key on `send`, deliberately.** A send is never reported as retryable once the conversation could have reached delivery, because a duplicate e-mail cannot be recalled - so there is nothing for a key to deduplicate against. If you need at-most-once for something like a daily report, the guard is yours: write a sent-marker row before the send and check it on the next tick.
   - **Inline images are NOT expressible.** Attachments are `{filename, contentType, base64|text}` with no content-id, and the structure is chosen for you - `text/plain`, `multipart/alternative` with `html`, wrapped in `multipart/mixed` when there are attachments. There is no `multipart/related`, so a `cid:` reference in your HTML has nothing to resolve against. Use an `https` image (most clients block remote images until the recipient allows them), attach the file normally, or leave it out; a `data:` URI is stripped by several clients including Outlook.

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff