Skip to content

Instantly share code, notes, and snippets.

@Suleman-Elahi
Last active August 14, 2025 18:18
A script to bulk create email accounts on MXroute via API. Sleep is not really necessary so can turn off. Use the users.csv file to create the CSV file with information of user to be created, quota must be given in MB. Just replace your username, password, server URL and good to go.
import requests
import csv
import time
server_login = 'YourUserName'
server_pass = 'YourPassword/LoginKey'
endpoint_url = 'AddSevrerURLHereWithPort' + '/CMD_EMAIL_POP' #Change the first part to he URL of the server you recoeved after sign up.
headers={"Content-Type": "application/x-www-form-urlencoded",}
data_template = '{"user":"%s","passwd2":"%s","passwd":"%s","quota":"%s","limit":"7200","domain":"%s","json":"yes","action":"create"}'
with open('users.csv', newline='\n') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
name = row['email'].split('@')[0].lower()
domain = row['email'].split('@')[1].lower()
password = row['password']
quota = row['quota']
data = data_template % (name, password, password, quota, domain)
response = requests.post(
endpoint_url,
headers=headers,
auth=(server_login, server_pass),
data=data,
timeout=5
)
print("Status: ",response.status_code," User ", name, " created !!")
time.sleep(2)
Display Name First name Last name email password quota
Ishan Ishan Ishan Ishan@example.com Password123@ 1024
Jitu K Jitu Kuba jitu.kb@example.com Password123@ 51200
@Suleman-Elahi
Copy link
Author

Create the CSV file in the specified format and do not change the column names unless you know what you are doing.

@firstkevinds
Copy link

What are the First name and Last name fields used for in the users.csv file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment