Forked from Suleman-Elahi/mxroute_email_accounts.py
Created
December 2, 2024 06:42
-
-
Save online-stuff/d92a3210c53fee6f4e8763ffab08823b to your computer and use it in GitHub Desktop.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Display Name | First name | Last name | password | quota | ||
---|---|---|---|---|---|---|
Ishan | Ishan | Ishan | [email protected] | Password123@ | 1024 | |
Jitu K | Jitu | Kuba | [email protected] | Password123@ | 51200 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment