TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/vanegasjoseignacio2-cyber/Eco-It/llms.txt
Use this file to discover all available pages before exploring further.
/api/contact endpoint is the single entry point for all contact form submissions on the Eco-It platform. It is fully public — no authentication token is required — meaning both registered users and unauthenticated visitors (guests) can reach out to the Eco-It team. When a submission is received, the server validates the input, renders a branded HTML email template, and delivers it to the configured admin inbox via Gmail SMTP using Nodemailer. The response is intentionally simple: a success flag and a friendly message.
The endpoint identifies whether the sender is a registered user by the optional presence of a
userId field in the request body. This distinction is reflected in the email as a coloured badge (“Usuario registrado” or “Invitado”) but does not affect validation or delivery.POST /api/contact
Validates the form payload, builds a styled HTML email, and dispatches it to the admin address defined in theADMIN_EMAIL environment variable (fallback: ecoit4167@gmail.com). The replyTo header of the email is set to the sender’s address so admins can reply directly from their inbox.
Auth: None (public)
Request Body
Full name of the person sending the message. Must be a non-empty string after trimming whitespace. Displayed prominently in the email header.
Email address of the sender. Validated against the pattern
\S+@\S+\.\S+. Used as the replyTo address so admins can respond directly. Must be non-empty.Category of the enquiry. One of the following keys:
Any other non-empty string is also accepted and displayed as-is.
| Key | Label displayed in email |
|---|---|
general | Consulta general |
support | Soporte técnico |
suggestion | Sugerencia |
partnership | Colaboración |
The body of the message. Must be a non-empty string. Rendered inside a styled blockquote in the email with
white-space: pre-wrap so line breaks are preserved.Optional MongoDB ObjectId of the authenticated user submitting the form. When present, the email badge reads “Usuario registrado”; when absent, it reads “Invitado”. This field is not validated against the database — its presence alone signals registration status.
Responses
HTTP 200 — Successtrue when the email was dispatched without error."¡Mensaje enviado! Te responderemos pronto." — a user-friendly confirmation message suitable for displaying in a toast or alert component.false.One of:
"Todos los campos son obligatorios."— when any required field is missing or blank."El formato del correo no es válido."— when theemailfield fails the regex check.
false."Error al enviar el mensaje. Intenta de nuevo.".The underlying Node.js / Nodemailer error message for debugging purposes.
cURL Example
What the Admin Receives
When a message is successfully processed, the admin inbox receives a rich HTML email with the following layout:- Header — Eco-It green gradient banner with the 🌿 logo and the label “Nuevo mensaje de contacto”.
- Badges — The subject category label and a coloured pill indicating “Usuario registrado” (blue) or “Invitado” (amber).
- Sender block — The sender’s name and a
mailto:link for their email address. - Message body — The full message text in a styled green-bordered blockquote.
- Reply button — A pre-addressed “Responder a [name]” CTA that opens a reply draft with
Re: [subject label]pre-filled. - Footer — The Colombia/Bogotá formatted timestamp of when the message was received.
[Eco-It] Soporte técnico — Valentina Rojas.
Email delivery is handled by a Nodemailer transporter configured for Gmail SMTP, created directly inside the contact controller. The sending address and password are read from the
EMAIL_USER and EMAIL_PASS environment variables at runtime. The destination admin address defaults to ecoit4167@gmail.com and can be overridden with the ADMIN_EMAIL environment variable.