# SweetBengal standalone app: brochure order email

This is an addition to the existing SweetBengal Delivery Charge app. It is NOT dependent on Shopify Forms or Shopify Flow.

## What this adds

- Public storefront endpoint: `/apps/sweetbengal-orders/order-request`
- Authenticated through Shopify App Proxy
- Receives the custom brochure form
- Recalculates each line total as quantity × unit price
- Stores the request in the app database
- Emails the request to `suhail@speciality.co.in`
- Uses a separate app SMTP From address
- Does not change Shopify's Settings → Notifications → Sender email
- Admin request list + detail + resend
- SMTP test email button

## Environment

Set:

```env
BROCHURE_ORDER_TO="suhail@speciality.co.in"
BROCHURE_EMAIL_FROM_NAME="SweetBengal Order Request"
BROCHURE_EMAIL_FROM_EMAIL="YOUR_SEPARATE_FROM_ADDRESS"
BROCHURE_EMAIL_SUBJECT_PREFIX="SweetBengal Order Request"
SMTP_HOST="YOUR_SMTP_HOST"
SMTP_PORT="465"
SMTP_SECURE="true"
SMTP_USER="YOUR_SMTP_USERNAME"
SMTP_PASS="YOUR_SMTP_PASSWORD_OR_APP_PASSWORD"
```

Do not use the Shopify store Sender email unless you actually want it to be the app's From address. The two systems are independent.

## Install / update

1. Create the Shopify custom app in the Dev Dashboard and link this local project using Shopify CLI.
2. Set the production `application_url` and redirect URL.
3. Install dependencies with `npm install`.
4. Run `npm run setup`.
5. Set the SMTP environment variables.
6. Run `npm run typecheck` and `npm run build`.
7. Deploy the app to an HTTPS host.
8. Run `shopify app deploy` so the `write_app_proxy` scope and app proxy configuration are applied.
9. Install the app on the SweetBengal store.
10. Open the app → Settings and use `Send test email`.
11. Use the `theme-integration/` files to point the brochure page at `/apps/sweetbengal-orders/order-request`.

## Theme integration

Upload:

- `theme-integration/sweetbengal-brochure-order-app.liquid` to Sections
- `theme-integration/sweetbengal-brochure-app.js` to Assets
- `theme-integration/sweetbengal-brochure.css` to Assets
- `theme-integration/page.sweetbengal-brochure-app.json` to Templates (optional)

Keep the existing 2200px brochure assets `page-01.webp` through `page-24.webp` in Assets.

## Test request

Submit a real brochure request. The customer should receive a success message. The app's `Brochure Order Requests` page should show the request and email status `SENT`. The email should arrive at `suhail@speciality.co.in` with Reply-To set to the customer's email.

## Separate From address

This feature is intentionally independent from Shopify's store Sender email. The app does not call any Shopify setting or API that changes the store's notification Sender address.

The email message uses `BROCHURE_EMAIL_FROM_EMAIL` as its From address and the customer's email as Reply-To. Your SMTP provider must authorize the chosen From address.
