IonfirmDOCS
Docssmart_ai_contactform Guide
smart_ai_contactform/Docs

API Keys (.env)

Configure your AI models and secure environment variables.

API Keys & Configuration (.env)

The .env file acts as the brain's control center. It tells the script which AI model to use, stores your secure API keys, and holds your SMTP email credentials.

Because this file contains sensitive passwords and keys, it is never exposed to the public frontend.

Step 1: Create your .env file

When you extract the script files, you will see a file named .env.example.

  1. Access your server via File Manager or FTP.
  2. Locate the .env.example file in the folder you just uploaded.
  3. Rename the file to exactly .env (remove the .example extension).

⚠️ Hidden Files Note: On some servers (like cPanel or macOS), files starting with a dot (.) are considered "hidden." If you don't see the file, ensure your file manager settings have "Show Hidden Files" turned on.

Step 2: Choose Your AI Engine

The Smart AI Contact Form supports multiple Large Language Models (LLMs). You can switch between them instantly by changing a single word.

Open your new .env file in a text editor and find the ACTIVE_LLM variable:

# --- AI ENGINE SELECTION ---
# Options: 'openai', 'gemini', or 'groq'
ACTIVE_LLM=openai

Step 3: Add Your API Keys

You only need to provide the API key for the engine you selected in Step 2. You can leave the other keys blank.

# --- API KEYS ---
# Get OpenAI key: https://platform.openai.com/api-keys
OPENAI_API_KEY="sk-your-openai-api-key-here"
 
# Get Gemini key: https://aistudio.google.com/app/apikey
GEMINI_API_KEY=""
 
# Get Groq key: https://console.groq.com/keys
GROQ_API_KEY=""

Step 4: Configure Email Routing (SMTP)

To ensure you receive notifications when a user requests human support, you must configure your SMTP settings.

Fill in the bottom half of the .env file with your hosting provider's email credentials:

# --- EMAIL SETTINGS (SMTP) ---
SMTP_HOST=smtp.yourhost.com
SMTP_PORT=465
SMTP_USER=support@yourdomain.com
SMTP_PASS="your_email_password"
 
# Who the email appears to be from
SMTP_FROM_EMAIL=noreply@yourdomain.com
SMTP_FROM_NAME="AI Smart Form"
 
# Where you want the support leads delivered
SUPPORT_EMAIL=admin@yourdomain.com