System Active

Herbalexia Mail Gateway

Securely route wholesale inquiries and B2B import requirements directly to your inbox via Google Mail SMTP.

API Sandbox

B2B Schema

Test B2B parameters and validation rules. Real email sends directly to your configured inbox.

Payload Fields

Sandbox Validation Output Logs
Diagnostics v1.1.0

No submissions triggered yet. Fill in the fields, insert your header x-api-key, and dispatch a test lead.

Developer Copy-Paste Snippets

Directly map these exact fields to your frontend form sections. Choose your stack below:

// 1. Create a function to trigger form submissions in React / Next.js
const handleB2BSubmit = async (formData) => {
  try {
    const response = await fetch("YOUR_VERCEL_DEPLOYMENT_URL/api/send-email", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "x-api-key": "YOUR_SECURE_API_KEY" // Configured in your environment variables
      },
      body: JSON.stringify({
        contactName: formData.contactName,               // e.g., "John Doe"
        companyName: formData.companyName,               // e.g., "Herbal Wellness Ltd"
        businessEmail: formData.businessEmail,           // e.g., "john@company.com"
        whatsappCountryCode: formData.whatsappCountryCode, // e.g., "+1" or "+91"
        whatsappNumber: formData.whatsappNumber,         // e.g., "9876543210" (strictly 10-digits)
        destinationCountry: formData.destinationCountry, // e.g., "Germany"
        productOfInterest: formData.productOfInterest,   // e.g., "Natural Henna Powder"
        requirements: formData.requirements,             // e.g., "Detail your volume requirements..."
        metadata: {
          submitted_url: window.location.href,
          timestamp: new Date().toISOString()
        }
      })
    });

    const result = await response.json();
    if (response.ok) {
      console.log("B2B Form routed successfully!", result);
      return { success: true };
    } else {
      console.error("API Validation Error:", result.details || result.error);
      return { success: false, error: result.details || result.error };
    }
  } catch (error) {
    console.error("Failed to connect to gateway server:", error);
    return { success: false, error: "Network connection failed." };
  }
};

B2B Mailer Implementation Flow

1

Gmail App Secret

Secure your standard Gmail authentication by setting up a unique 16-character App Password inside Google Account Security settings (requires 2-Step Verification to be enabled).

2

Form Integration

In your front-end code, wire your submit event listener to hit this endpoint via a `POST` method. Enforce 10-digit phone filtering by stripping spaces and symbols before transmitting data.

3

Vercel Deployment

Deploy this Next.js folder to Vercel. Set `SMTP_USER`, `SMTP_PASSWORD`, `TO_EMAIL`, and `API_KEY` as production environment variables to automatically support unlimited submissions.