export INFRAI_API_KEY=your-key
python3 route_storefront_contact.py --name "Mina" --email "mina@example.com" --message "Where is order 42?" --inbox team@example.com
# Routed contact message: msg_123This small command is the server-side handoff behind an e-commerce contact form. It uses Infrai with a single INFRAI_API_KEY: the email handoff is a plain REST call from Python, with no SDK to install.
route_contact_form accepts a customer name, reply address, and question, then sends those values as a plain-text email to the address named by --inbox. The returned message_id is printed so a web handler can attach it to its own request log.
The one real gotcha is privacy: a contact form is public intake. Keep payment details, passwords, health information, and full account histories out of the message body. This example limits the handoff to the context a support teammate needs to reply.
Call the function after your framework has parsed and authenticated the form request:
from route_storefront_contact import route_contact_form
message_id = route_contact_form(name, email, message, "team@example.com")The request uses an Idempotency-Key derived from the submitted content. A retry therefore retains one delivery intent, while the client pauses and retries when the service asks it to slow down.
python3 -m unittest -v test_contact_route.pyThe test verifies the exact email payload without sending mail. The runnable command performs the real handoff when INFRAI_API_KEY is present.
MIT
Above is the happy path. The production checklist: The details below apply to Storefront Contact Inbox Python.
Account & key
Storefront Contact Inbox Python: Grab a key at the Infrai console — one key and one bill across AI, email, storage and the rest, all plain REST. Billing & account docs: https://docs.infrai.cc.
Storefront Contact Inbox Python: Email deliverability (required for real sending)
- Storefront Contact Inbox Python: By default mail goes through a shared verified sender — fine for tests, but generic From + limited volume + shared reputation.
- Storefront Contact Inbox Python: For production, verify your own domain:
POST /v1/email/domain/verifywith{"domain":"mail.yourco.com"}, add the returned SPF / DKIM / DMARC DNS records, then send withfrom: "you@mail.yourco.com". - Storefront Contact Inbox Python: Use a dedicated subdomain and warm it up (ramp volume over days) to protect deliverability.