SMTP Credentials API
API reference for creating and managing SMTP credentials for relay-based email sending in Taifa Mail.
Base URL: https://govconnect.ke/v1
All endpoints require authentication via API Key or JWT cookie.
Create SMTP credentials
Creates a new set of SMTP credentials for a verified domain. The password is returned only once in the response. Store it securely.
Request body:
| Field | Type | Required | Description |
|---|---|---|---|
domain_id | UUID | Yes | The ID of a verified domain to associate these credentials with. |
The domain must have a verified status before you can create SMTP credentials. Use the Domains API to register and verify your domain first.
Response (201 Created):
The username is derived automatically as the first 8 characters of your account ID followed by @ and the domain name. There is one SMTP credential per domain.
The password field is only returned when the credential is created. It cannot be retrieved again. If you lose it, deactivate the credential and create a new one.
SMTP connection details
| Setting | Value |
|---|---|
| Host | mail.govconnect.ke |
| Port | 587 |
| Encryption | STARTTLS |
| Authentication | Username + password from the create response |
cURL
Python
Node.js
List SMTP credentials
Returns an array of active SMTP credentials for the authenticated account. Passwords are never returned in list responses.
Response:
Python
Node.js
Deactivate SMTP credentials
Permanently deactivates an SMTP credential. Any SMTP connections using this credential will be rejected after deactivation.
| Parameter | Type | Description |
|---|---|---|
credential_id | UUID (path) | The ID of the SMTP credential to deactivate. |
Response (204 No Content):
No response body.
Python
Node.js
Deactivating credentials is irreversible. Any application or mail client using these credentials will lose the ability to send email immediately. Deactivated credentials still appear in the list response with is_active: false.
Using SMTP credentials
Once you have your credentials, you can send email from any application or library that supports SMTP. Here are examples for common setups.
Python (smtplib)
Node.js (nodemailer)
Errors
| Status | Description |
|---|---|
400 Bad Request | The specified domain has not been verified yet. |
401 Unauthorized | Missing or invalid authentication. |
403 Forbidden | You have reached the SMTP credential limit for your plan. |
404 Not Found | The specified domain or credential ID does not exist or does not belong to your account. |
409 Conflict | An active SMTP credential already exists for this domain. Delete it before creating a new one. |