GastroMóvil sends all user-facing transactional emails through Resend, a developer-focused email API. The integration lives inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/lffiesco-svg/gastromovil/llms.txt
Use this file to discover all available pages before exploring further.
usuarios/views.py and is a thin wrapper around resend.Emails.send(). A separate legacy SMTP backend (SSLEmailBackend) handles outbound mail from the contacto app’s contact form. Real-time order status notifications are delivered over WebSocket via Django Channels — those are not email-based and are covered in the Delivery Tracking documentation.
Resend Integration
All transactional messages are sent from a single helper function defined at the top ofusuarios/views.py:
from address is always GastroWeb <noreply@gastromovil.online>. The function returns True on success and False on any exception, making it safe to call from background threads without crashing the request cycle.
The
RESEND_API_KEY setting is loaded from the environment via
config('RESEND_API_KEY') in settings.py. The API key is injected into
resend.api_key on every call so the module-level global is always fresh —
useful if the key is rotated without restarting the server.Transactional Emails
1 — Registration Verification
When a new user submits the sign-up form, a 6-digit numeric code is generated withrandom.randint(100000, 999999) and stored in the session. The code is emailed immediately and must be entered on the verification page before the Usuario record is created.
CodigoRecuperacion model is used here — the code lives only in the session.
2 — Login Alert
Every successful password-based login triggers a background email alerting the user to the new session. The email is sent in a daemon thread so it does not block the redirect:request.META['REMOTE_ADDR'] and included in the footer note alongside the login timestamp.
3 — Password Recovery (6-digit code)
Password recovery uses theCodigoRecuperacion model to persist the 6-digit code in the database with a 10-minute expiry. Two entry points exist: a REST API endpoint (enviar_codigo) used by the mobile flow and a web endpoint (enviar_codigo_web) used by the browser flow.
4 — Password Changed Confirmation
After a successful password reset, a plain-text confirmation is dispatched asynchronously:HTML Email Templates
All branded emails are built with helper functions fromusuarios/email_template.py. The template produces a single-column responsive table layout with a crimson (#c0392b) header and a GastroWeb logo emoji.
| Helper | Purpose |
|---|---|
get_email_html(titulo, contenido_central) | Outer wrapper — header, title row, content area, and footer |
codigo_box(codigo) | Renders the 6-digit code in a large dashed box |
parrafo(texto) | Body paragraph with #555555 text at 15 px / 1.7 line-height |
nota(texto) | Small centred footnote in #aaaaaa at 13 px |
Legacy SMTP Backend (Contact Form)
Thecontacto app sends outbound mail through a custom SSLEmailBackend that wraps Django’s built-in SMTP backend. The backend opens a plain SMTP connection on port 465, upgrades it to TLS via STARTTLS, and authenticates with the configured Gmail credentials.
Real-Time Order Notifications
Order status changes (e.g., accepted, picked up, delivered) are pushed to the browser over WebSocket using Django Channels with an in-memory channel layer. This is entirely separate from email. No SMTP or Resend call is made when an order changes state.The WebSocket consumer and channel routing are documented in the Delivery
Tracking section of this documentation.