Postal mail

A letter is a file.

Write a .letter.tsx or a .postcard.tsx, or let an agent write it. Lob or Click2Mail prints and posts it, and its record lands in your Drive.

A send

Quoted, held, printed, posted.

The price is the provider's own. Credits are held before the provider is asked, and a refusal releases the hold.

How a letter is sentA letter is a .letter.tsx file. A send names the file. The platform quotes the provider's price, holds it from the account's credits, then asks Lob or Click2Mail to print and post it. The piece's record and the PDF that was sent are written into the account's Drive under postal/outbound, and the provider's tracking events are appended as they come.Welcome.letter.tsxto, from, paragraphsThe provider's priceheld from credits firstLob or Click2Mailprints and postspostal/outbound/<pie-ce>/record.jsonl, sent.pdfHow a letter is sentA letter is a .letter.tsx file. A send names the file. The platform quotes the provider's price, holds it from the account's credits, then asks Lob or Click2Mail to print and post it. The piece's record and the PDF that was sent are written into the account's Drive under postal/outbound, and the provider's tracking events are appended as they come.Welcome.letter.tsxto, from, paragraphsThe provider's priceheld from credits firstLob or Click2Mailprints and postspostal/outbound/<piece>/record.jsonl, sent.pdf

The postal pane edits this code.

Each edit in the pane, an address, the mail class, a paragraph, is written back into the file. Its Python and Rust twins say the same letter.

cloud://global/examples/postal/code/Welcome.letter.tsxthe shipped example · an example address
<letter color={false} doubleSided={false} mailClass="first">
  <to name="Ada Lovelace" line1="12 St James's Square" city="London" postalCode="SW1Y 4JH" country="GB" />
  <from name="Northwind Survey" line1="1 Main St" city="Portland" region="OR" postalCode="97201" country="US" />
  <paragraph text="Dear Ada," />
  <paragraph text="Thank you for your order. The survey kit ships on Monday." />
  <paragraph text="Yours, Northwind Survey" />
</letter>

Where it stands

Built and tested, no letter mailed yet.

The route tests run the real routes, keys, ledger and Drive with a fake only at each provider's API. A Click2Mail production account answers read-only calls; no job has been submitted (docs/postal.md).

Measured, not guessed

The three postcard sizes and their ink-free zones were measured in Lob's own templates. A 6 × 9 card quotes at $1.03.

A lost submit is unknown

A submit whose answer was lost is recorded unknown, keeps its job id, and the clock reads its real state later.

Paper in, later

Renting a mailbox that scans paper mail is modelled. It answers no_inbound_provider until one is set up.

Mail a letter from code.

Open the example, change a paragraph, and see the price.