Docs  /  Gmail SMTP (send mail)

Gmail SMTP (send mail)

_AugmentedIntelligence can send mail through Gmail SMTP using a Google App Password (not your normal Google account password).

Transport: libcurl SMTP · host smtp.gmail.com · port 587 (STARTTLS) or 465 (SSL).

One-time Google setup

  1. Open Google Account → Security.
  2. Turn on 2-Step Verification (required for App Passwords).
  3. App passwords → select Mail / Other → generate a 16-character password.
  4. Copy the password (spaces are fine; the app strips them).

Workspace / admin-managed accounts may need the admin to allow App Passwords or SMTP.

Connect in the app

email connect gmail user you@gmail.com pass abcd efgh ijkl mnop

Optional flags:

email connect gmail user you@gmail.com pass YOUR_APP_PASSWORD from you@gmail.com to alerts@company.com port 587

Short form:

email gmail user you@gmail.com pass YOUR_APP_PASSWORD

Help:

email help gmail
email status

Send

email test
email send to friend@example.com subject Hello from AI message This is a test body.

Default notify recipient is set to your Gmail address on connect (override with to / email config to).

Environment variables

Loaded automatically on first send/status if SMTP is still empty (email env to force):

Variable Purpose
GMAIL_USER / AI_GMAIL_USER Full Gmail address
GMAIL_APP_PASSWORD / AI_GMAIL_APP_PASSWORD App password
GMAIL_FROM From address (defaults to user)
GMAIL_NOTIFY_TO / EMAIL_NOTIFY_TO Default notification recipient
GMAIL_SMTP_PORT 587 or 465

Example (PowerShell):

$env:GMAIL_USER = "you@gmail.com"
$env:GMAIL_APP_PASSWORD = "abcdefghijklmnop"
# then start the app and:
# email env
# email test

Persistence

Connect saves settings via _Settings::SaveSettings() (MySQL primary + optional settings.txt mirror):

  • email_smtp_host, email_smtp_port, email_smtp_user, email_smtp_from
  • email_smtp_password (password store / redaction-aware)
  • email_notify_to, email_notify_enabled

Use nosave on the connect line to keep credentials session-only:

email connect gmail user you@gmail.com pass YOUR_APP_PASSWORD nosave

Lua

local ok, details = email_connect_gmail("you@gmail.com", "abcdefghijklmnop")
print(ok, details)
print(email_status())
local sent, err, transport = email_send("friend@example.com", "Hi", "Body")

Also: email_test(), email_gmail_ready().

Script bridge: lua_scripts/Email-Bridge.lua.

Generic SMTP (non-Gmail)

email config smtp host mail.example.com port 587 from noreply@example.com user u pass p tls on
email config to ops@example.com
email config enabled on

Troubleshooting

Symptom Fix
Authentication failed / curl 67 Use App Password, not account password; ensure 2FA is on
Login denied Wrong user (must be full name@gmail.com)
SSL errors Port 587 + TLS; update CA store; try port 465
email_notify_to is not configured email config to you@gmail.com or pass to on connect
Workspace blocks SMTP Admin must allow “Less secure” alternatives → App Passwords / SMTP relay

Security notes

  • Prefer App Passwords over account passwords; revoke them in Google Account if leaked.
  • Do not commit app passwords into git or scripts checked into source control.
  • Prefer env vars or AD password store for production hosts.
email status
email test
email send to <addr> subject <text> message <text>
email config to <addr>
email config enabled on|off
email env [force]
Generated from the project markdown docs on 2026-07-24. This is a static, self-contained site.