
Security News
The Nightmare Before Deployment
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.
coremail
Advanced tools
A comprehensive Python SDK for interacting with Coremail XT API v3, providing easy access to all available API endpoints for user, organization, and system management.
pip install coremail
Create a .env file in your project root with the following variables:
COREMAIL_BASE_URL=http://your-coremail-server:9900/apiws/v3
COREMAIL_APP_ID=your_app_id@your_domain.com
COREMAIL_SECRET=your_secret_key
from coremail import CoremailClient
# Initialize the client with environment variables
client = CoremailClient()
# Or with explicit parameters
client = CoremailClient(
base_url="http://your-host-of-coremail:9900/apiws/v3",
app_id="your_app_id@your-domain.com",
secret="your_secret_key"
)
# Example: Request a token
token = client.requestToken()
print(f"Token: {token}")
# Example: Get user attributes
user_attrs = client.getAttrs("test_user@your-domain.com")
print(f"User attributes: {user_attrs}")
# Create a new user
attrs = {
"display_name": "John Doe",
"cos_id": 1,
"quota": 1024
}
client.createUser("john.doe@your-domain.com", "password123", attrs)
# Get user attributes
user_attrs = client.getAttrs("john.doe@your-domain.com")
# Update user attributes
update_attrs = {"display_name": "Jane Doe", "quota": 2048}
client.setAttrs("john.doe@your-domain.com", update_attrs)
# Delete a user
client.delUser("john.doe@your-domain.com")
# Create an organization
org_attrs = {
"org_name": "Example Organization",
"domain_name": "example.com",
"cos_id": [1],
"num_of_classes": [100],
"org_status": 0,
"org_expiry_date": "2025-12-31"
}
client.addOrg("example_org", org_attrs)
# Get organization information
org_info = client.getOrgInfo("example_org")
# Update organization
update_attrs = {"org_name": "Updated Organization Name"}
client.alterOrg("example_org", update_attrs)
# User login to get session ID
session_id = client.userLogin("user@domain.com")
print(f"Session ID: {session_id}")
# Check user session
user_info = client.sesTimeOut(session_id)
print(f"User info: {user_info}")
# Logout user
client.userLogout(session_id)
The SDK includes methods for all Coremail XT API v3 endpoints:
requestToken() - Request a new access tokenuserLogin(user_at_domain) - User login to get session IDuserLoginEx(user_at_domain, attrs) - User login with additional parametersuserExist(user_at_domain) - Check if user existsuserExist2(user_at_domain) - Check if a user without alias name exists (returns boolean)authenticate(user_at_domain, password) - Verify user passwordsesTimeOut(ses_id) - Check user's session and return user informationsesRefresh(ses_id) - Refresh user's sessiongetSessionVar(ses_id, ses_key) - Get variable from user's sessionuserLogout(ses_id) - Logout user sessionsetSessionVar(ses_id, ses_key, ses_var) - Set variable in user's sessionaddOrg(org_id, attrs) - Create organizationgetOrgInfo(org_id, attrs) - Get organization infoalterOrg(org_id, attrs) - Modify organizationaddOrgDomain(org_id, domain_name) - Add domain to organizationdelOrgDomain(org_id, domain_name) - Delete domain from organizationaddOrgCos(org_id, num_of_classes, cos_name, cos_id) - Add service levelalterOrgCos(org_id, num_of_classes, cos_name, cos_id) - Update service leveldelOrgCos(org_id, cos_id) - Delete service levelgetOrgCosUser(org_id, cos_id) - Get users in service levelgetOrgList() - Get list of organizationsaddUnit(org_id, unit_name, attrs) - Add organizational unitdelUnit(org_id, unit_name) - Delete organizational unitgetUnitAttrs(org_id, unit_name, attrs) - Get organizational unit attributessetUnitAttrs(org_id, unit_name, attrs) - Set organizational unit attributescreateUser(user_at_domain, password, attrs) - Create userdeleteUser(user_at_domain) - Delete usergetAttrs(user_at_domain, attrs) - Get user attributeschangeAttrs(user_at_domain, attrs) - Change user attributesaddSmtpAlias(user_at_domain, alias) - Add SMTP alias for userdelSmtpAlias(user_at_domain, alias) - Delete SMTP alias for usergetSmtpAlias(user_at_domain) - Get SMTP aliases for usersetAdminType(user_at_domain, admin_type) - Set admin type for usergetAdminType(user_at_domain) - Get admin type for userrenameUser(old_user_at_domain, new_user_at_domain) - Rename usermoveUser(user_at_domain, target_org_id, target_unit_name) - Move user to different organization/unitcreateObj(obj_type, obj_name, org_id, attrs) - Create object (e.g., mailing list)getObjAttrs(obj_type, obj_name, org_id, attrs) - Get object attributessetObjAttrs(obj_type, obj_name, org_id, attrs) - Set object attributesdeleteObj(obj_type, obj_name, org_id) - Delete objectdomainExist(domain_name) - Check if domain existsgetDomainList(start, limit) - Get domain listaddDomain25(domain_name, attrs) - Add domain for port 25 (SMTP)delDomain25(domain_name) - Delete domain for port 25 (SMTP)addDomainAlias(domain_name, alias_domain_name) - Add domain aliasgetDomainAlias(domain_name) - Get domain aliasesdelDomainAlias(domain_name, alias_domain_name) - Delete domain aliasgetOrgListByDomain(domain_name) - Get organization list by domainlistMailInfos(user_at_domain, start_time, end_time, attrs) - List mail informationgetNewMailInfos(user_at_domain, start_time, end_time, attrs) - Get new mail informationsmtpTransport(sender, recipient, content) - SMTP transport for message deliverygetUserFromCasName(cas_name) - Get user email address from CAS nameThe SDK raises exceptions for API errors:
try:
user_attrs = client.getAttrs("nonexistent_user@domain.com")
except Exception as e:
print(f"API Error: {e}")
To run the example:
python example.py
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A comprehensive Python SDK for interacting with Coremail XT API
We found that coremail demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.

Research
/Security News
Impostor NuGet package Tracer.Fody.NLog typosquats Tracer.Fody and its author, using homoglyph tricks, and exfiltrates Stratis wallet JSON/passwords to a Russian IP address.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.