# Contact Production Environment Examples

Placeholders only. Do **not** commit real secrets.

Recipient emails are configured **per store in Admin**, not as a shared env value.

Only configure **one** active mailer.

---

## Shared application

```env
APP_ENV=production
APP_DEBUG=false
APP_URL=https://api.example.com

MAIL_FROM_ADDRESS=noreply@example.com
MAIL_FROM_NAME="Store Name"
```

From address must be verified with the provider (domain/signature).

---

## Option 1 — Mailgun

```env
MAIL_MAILER=mailgun
MAILGUN_DOMAIN=mg.example.com
MAILGUN_SECRET=CHANGE_ME
MAILGUN_ENDPOINT=api.mailgun.net
# EU region example:
# MAILGUN_ENDPOINT=api.eu.mailgun.net
```

---

## Option 2 — Postmark

```env
MAIL_MAILER=postmark
POSTMARK_API_KEY=CHANGE_ME
# Optional alias some setups use:
# POSTMARK_TOKEN=CHANGE_ME
# Optional message stream id if used by your Postmark setup:
# POSTMARK_MESSAGE_STREAM_ID=outbound
```

---

## Option 3 — SMTP

```env
MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=587
MAIL_USERNAME=CHANGE_ME
MAIL_PASSWORD=CHANGE_ME
MAIL_SCHEME=tls
```

---

## Queue — preferred database worker

```env
QUEUE_CONNECTION=database
```

Requires a long-running worker or cPanel cron `--stop-when-empty` (see runbook).

---

## Queue — intentional sync fallback

```env
QUEUE_CONNECTION=sync
```

Jobs run inline with the HTTP/CLI process. Acceptable only as an intentional small-site fallback. Prefer a real queue + worker for production Contact mail.

---

## After editing env on the server

```bash
cd /path/to/api
php artisan config:clear
php artisan config:cache
php artisan contact:production-audit --json
php artisan contact:verify-mail --store=STORE_CODE --dry-run --json
```
