# Email auto-responder _Your second stack: pull a package that replies to email. Deploy it, mint a mail host, send it a message, get an auto-reply back — all on the hosted service. ([Hello, world](./hello-world.md) first if you haven't.)_ Where [hello, world](./hello-world.md) answered the web, this one answers **email**. You'll pull the `auto-responder` package — two rules that accept inbound mail and reply once, with the loop protection a real auto-responder needs — then give it a mail address with a single command. No inbox to host, no DNS to configure. :::note **Cloud or local?** This tutorial uses the hosted service (free tier), where inbound mail "just works." To run it locally instead, `txco dev --personalities=cron,web,admin,lmtp` boots a chassis with the mail head and you drive it with `swaks` over LMTP — see the [inbound-mailbox example](https://github.com/loremlabs/thanks-computer/tree/main/examples/inbound-support-mailbox) and [lmtp.md](../advanced/protocols/lmtp.md). The cloud path below is the simplest. ::: ## 1. Sign in If you're continuing from the last tutorial you're already signed in. Otherwise: ```sh txco login ``` ## 2. Pull the package ```sh mkdir autoresponder && cd autoresponder txco install auto-responder --as autoreply ``` ``` ✔ verified: signed by txco [SHA256:…] installed auto-responder 0.1.0 as stack "autoreply/_mail" (2 files) Review OPS/autoreply/, then run `txco apply` to deploy. ``` `auto-responder` is a **mail** package — its rules live in a `_mail` channel, not the web scope. `--as autoreply` nests that channel under your chosen stack name, so it lands at `OPS/autoreply/_mail/`. (`--as` renames the base and keeps the channel; for the web hello-world package the same flag just renamed the stack.) Read what you're about to run: ```sh cat OPS/autoreply/_mail/0/accept.txcl OPS/autoreply/_mail/100/reply.txcl ``` ```txcl # 0/accept.txcl — accept every inbound recipient (250) so mail lands. WHEN @src == "lmtp" EMIT @lmtp.res.code = 250, @lmtp.res.msg = "accepted" # 100/reply.txcl — reply once, skipping bounces and other auto-replies. WHEN @lmtp.is_bounce == false && @lmtp.msg.headers.auto-submitted == "" SET ._sendmail.to = @lmtp.mail.from, ._sendmail.from = @lmtp.rcpt.0, ._sendmail.subject = &concat("Re: ", @lmtp.msg.subject), ._sendmail.body = "
Thanks for your message! This is an automated reply.
", ._sendmail.envelope_from = "<>", ._sendmail.campaign = &concat("autoreply:", @lmtp.msg.id) EXEC "txco://sendmail" ``` The reply goes **from** the address that was written to (`@lmtp.rcpt.0`) **to** the original sender (`@lmtp.mail.from`). Three guards stop mail storms: skip bounces (`@lmtp.is_bounce`), skip anything already `Auto-Submitted`, and an at-most-once `campaign` keyed on the inbound `Message-ID`. The null `<>` reverse-path is the RFC-3834 auto-reply convention. ## 3. Deploy ```sh txco apply ``` ``` autoreply/_mail v1 activated (2 files) ``` No URL is printed — a mail stack has no web channel, so it doesn't auto-mint a host. You mint one in the next step. ## 4. Give it a mail address ```sh txco auth tenant hostnames add --mint --stack autoreply ``` ``` minted autoreply-a1b2c3.stacks.thanks.computer → prod-you/autoreply routes immediately (verified + DKIM); mail to