[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$fQJnB9eF0mN_-x_aRf7QOpe8vd6-Q-wwR9FzlPCSJc2Q":3},{"id":4,"question":5,"answer":6,"answerHtml":7,"slug":8,"keywords":9,"article":10,"status":34,"aiModel":39,"aiConfidence":39,"updatedAt":51,"createdAt":51,"_status":50},541,"How can I download attachments from a MailEnable email via the API?","After viewing an email and obtaining the `MessageID` and `Filename` from the XML response, send a request to `\u002FMEWebMail\u002FMondo\u002Flang\u002Fsys\u002FForms\u002FMAI\u002FGetAttachment.aspx` with `Folder`, `MessageID`, and `Filename` parameters. The attachment can be saved as text or binary. For a full implementation, see the [MailEnable Development Guide](\u002Fnews\u002Fmailenable-development-guide).","\u003Cp>After viewing an email and obtaining the `MessageID` and `Filename` from the XML response, send a request to `\u002FMEWebMail\u002FMondo\u002Flang\u002Fsys\u002FForms\u002FMAI\u002FGetAttachment.aspx` with `Folder`, `MessageID`, and `Filename` parameters. The attachment can be saved as text or binary. For a full implementation, see the [MailEnable Development Guide](\u002Fnews\u002Fmailenable-development-guide).\u003C\u002Fp>\u003Cp>\u003Ca href=\"\u002Fnews\u002Fmailenable-development-guide\">Read the related One Day Sec article\u003C\u002Fa>\u003C\u002Fp>","how-can-i-download-attachments-from-a-mailenable-email-via-the-api-1777483110596","MailEnable, attachment download, API",{"id":11,"title":12,"slug":13,"description":14,"content":15,"contentHtml":30,"cover":31,"author":32,"views":19,"readingTime":33,"status":34,"publishedAt":35,"seo":36,"tags":41,"qaPairs":42,"meta":47,"updatedAt":48,"createdAt":49,"_status":50},133,"MailEnable Development Guide","mailenable-development-guide","Learn to access MailEnable mail using Python scripts. This guide covers setup, version detection, user login, and folder management with open-source code.",{"root":16},{"type":17,"format":18,"indent":19,"version":20,"children":21,"direction":29},"root","",0,1,[22],{"type":23,"format":18,"indent":19,"version":20,"children":24,"direction":29},"paragraph",[25],{"mode":26,"text":27,"type":28,"style":18,"detail":19,"format":19,"version":20},"normal","\u003Chtml>\u003Chead>\u003C\u002Fhead>\u003Cbody>\u003Ch2>0x00 Preface\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>MailEnable provides an end-to-end solution for delivering secure email and collaboration services. According to the official website: a recent independent survey reported MailEnable as the world's most popular Windows mail server platform.\u003C\u002Fp>\u003Cp>For the MailEnable developer API, I only found documentation for the AJAX API on the official website. Therefore, this article will attempt to write Python scripts to access MailEnable mail, document the development details, and open-source the code.\u003C\u002Fp>\u003Ch2>0x01 Introduction\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>This article will cover the following:\u003C\u002Fp>\u003Cul>\u003Cli>Environment Setup\u003C\u002Fli>\u003Cli>Development Details\u003C\u002Fli>\u003Cli>Open-source code MailEnableManage.py\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>0x02 Environment Setup\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Ch3>1. Installation\u003C\u002Fh3>\u003Cp>Before installation, IIS service and .NET 3.5 must be installed; otherwise, Web access cannot be configured properly.\u003C\u002Fp>\u003Cp>MailEnable download address: http:\u002F\u002Fwww.mailenable.com\u002Fdownload.asp\u003C\u002Fp>\u003Ch3>2. Configuration\u003C\u002Fh3>\u003Cp>Start MailEnableAdmin.msc, configure mail server information under MailEnable Management-&gt;Messaging Manager-&gt;Post Offices\u003C\u002Fp>\u003Cp>As shown below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fuploads\u002Fdocx_image_1770017970338_0_d3f40b2fa0.jpeg\">\u003C\u002Fp>\u003Cp>Default login page:\u003C\u002Fp>\u003Cp>http:\u002F\u002Fmewebmail.localhost\u002Fmewebmail\u002FMondo\u002Flang\u002Fsys\u002Flogin.aspx\u003C\u002Fp>\u003Ch3>3. Enable Web Management Page\u003C\u002Fh3>\u003Cp>Reference:\u003C\u002Fp>\u003Cp>http:\u002F\u002Fwww.mailenable.com\u002Fkb\u002Fcontent\u002Farticle.asp?ID=ME020132\u003C\u002Fp>\u003Cp>Start MailEnableAdmin.msc, select MailEnable Management-&gt;Servers-&gt;localhost-&gt;Services and Connectors-&gt;WebAdmin, right-click and choose Properties from the pop-up menu, select the Configure... button to install\u003C\u002Fp>\u003Cp>As shown below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fuploads\u002Fdocx_image_1770017979571_1_d905d79fce.jpeg\">\u003C\u002Fp>\u003Cp>Start MailEnableAdmin.msc, under MailEnable Management-&gt;Messaging Manager-&gt;Post Offices, select the configured Post Office, right-click and choose Properties from the pop-up menu, switch to the Web Admin tab, enable web administration\u003C\u002Fp>\u003Cp>As shown below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fuploads\u002Fdocx_image_1770017987478_2_9713e3a4ec.jpeg\">\u003C\u002Fp>\u003Cp>Select the specified user and modify the attributes to administrator\u003C\u002Fp>\u003Cp>Default management page:\u003C\u002Fp>\u003Cp>http:\u002F\u002Fmewebmail.localhost\u002Fmeadmin\u002FMondo\u002Flang\u002Fsys\u002Flogin.aspx\u003C\u002Fp>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>If the user's plaintext password is forgotten, you can check the Auth.tab file in the default installation path C:\\Program Files (x86)\\Mail Enable\\Config, which stores the plaintext password for each mailbox user\u003C\u002Fp>\u003Ch2>0x03 Development Details\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Ch3>1. Version Determination\u003C\u002Fh3>\u003Cp>After testing multiple versions, the summarized version determination method is as follows:\u003C\u002Fp>\u003Cp>Access the login page: http:\u002F\u002F\u003Curl>\u002Fmewebmail\u002FMondo\u002Flang\u002Fsys\u002Flogin.aspx\u003C\u002Furl>\u003C\u002Fp>\u003Cp>View the webpage source code, as shown in the figure below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fuploads\u002Fdocx_image_1770017993187_3_727ccf1002.jpeg\">\u003C\u002Fp>\u003Cp>In \u003Clink rel=\"stylesheet\" type=\"text\u002Fcss\" href=\"\u002FMEWebMail\u002FMondo\u002Fskins\u002FArctic\u002Fme.css?v=9.84\">, v=9.84 corresponds to the MailEnable version\u003C\u002Fp>\u003Cp>In script implementation, I adopted the following method:\u003C\u002Fp>\u003Col>\u003Cli>Find the position of ?v=\u003C\u002Fli>\u003Cli>Extract a fixed-length string backward\u003C\u002Fli>\u003Cli>Use \" as delimiter to obtain version number\u003C\u002Fli>\u003C\u002Fol>\u003Ch4>Supplement: Obtain version number via MailEnableAdmin.msc\u003C\u002Fh4>\u003Cp>Launch MailEnableAdmin.msc, select MailEnable Management-&gt;Servers-&gt;localhost-&gt;System-&gt;Diagnose\u003C\u002Fp>\u003Cp>As shown below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fuploads\u002Fdocx_image_1770017996699_4_02ed28a68d.jpeg\">\u003C\u002Fp>\u003Cp>\u003Cstrong>Note: Version number list\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>http:\u002F\u002Fwww.mailenable.com\u002FPremium-ReleaseNotes.txt\u003C\u002Fp>\u003Cp>http:\u002F\u002Fwww.mailenable.com\u002FStandard-ReleaseNotes.txt\u003C\u002Fp>\u003Ch3>2. User login\u003C\u002Fh3>\u003Cp>Access URL: \u002Fmewebmail\u002FMondo\u002FServlet\u002Frequest.aspx\u003C\u002Fp>\u003Cp>Required key parameters:\u003C\u002Fp>\u003Cul>\u003Cli>txtUsername\u003C\u002Fli>\u003Cli>txtPassword\u003C\u002Fli>\u003Cli>loginParam\u003C\u002Fli>\u003C\u002Ful>\u003Cp>The result is returned in JSON format. If the login is successful, the value of bReportLoginFailure is False.\u003C\u002Fp>\u003Cp>The corresponding Python code is as follows:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>def Check(host, username, password):\u003Cbr>    url = host + \"\u002Fmewebmail\u002FMondo\u002FServlet\u002Frequest.aspx?Cmd=LOGIN&amp;Format=JSON\"\u003Cbr>\u003Cbr>    body = {\u003Cbr>            \"txtUsername\": username,\u003Cbr>            \"txtPassword\": password,\u003Cbr>            \"ddlLanguages\": \"en\",\u003Cbr>            \"ddlSkins\":\"Arctic\",\u003Cbr>            \"loginParam\":\"SubmitLogin\"\u003Cbr>            }  \u003Cbr>    postData = urllib.parse.urlencode(body).encode(\"utf-8\")           \u003Cbr>    headers = {\u003Cbr>        \"User-Agent\": \"Mozilla\u002F5.0 (X11; Linux x86_64; rv:52.0) Gecko\u002F20100101 Firefox\u002F52.0\",\u003Cbr>        \"Content-Type\": \"application\u002Fx-www-form-urlencoded\",    \u003Cbr>    }         \u003Cbr>    r = requests.post(url, headers=headers, data=postData, verify = False)\u003Cbr>    if r.status_code ==200 and r.json()[\"bReportLoginFailure\"] == False:\u003Cbr>        print(\"[+] Valid:%s  %s\"%(username, password))      \u003Cbr>    else:\u003Cbr>        print(r.status_code)\u003Cbr>        print(r.text)\u003Cbr>    r.close()\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>3. View email folders\u003C\u002Fh3>\u003Cp>Access URL: \u002FMEWebMail\u002FMondo\u002FServlet\u002Fasyncrequest.aspx\u003C\u002Fp>\u003Cp>Required key parameters:\u003C\u002Fp>\u003Cul>\u003Cli>Folder, which can be specified as inbox\u002Fsent\u002Fdrafts\u002Fdeleted\u002Fjunk\u003C\u002Fli>\u003Cli>ME_VALIDATIONTOKEN, needs to be obtained by accessing \u002Fmewebmail\u002FMondo\u002FServlet\u002Frequest.aspx?Cmd=GET-MBX-OPTIONS&amp;Scope=2, retrieved from the response\u003C\u002Fli>\u003C\u002Ful>\u003Cp>The response is in XML format, containing the number of all emails in the folder and brief content of each email. ID serves as the unique identifier for each email and is required as a parameter when reading emails\u003C\u002Fp>\u003Cp>To improve efficiency, you can use xml.dom to parse XML.\u003C\u002Fp>\u003Cp>Reference materials for parsing XML with xml.dom:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fdocs.python.org\u002F3.8\u002Flibrary\u002Fxml.dom.minidom.html#xml.dom.minidom.parse\u003C\u002Fp>\u003Cp>Python code for parsing XML with xml.dom and extracting TOTAL_ITEMS:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>from xml.dom import minidom\u003Cbr>DOMTree = minidom.parseString(r.text)\u003Cbr>collection = DOMTree.documentElement\u003Cbr>total = collection.getAttribute(\"TOTAL_ITEMS\")\u003Cbr>print(\"[+] TOTAL_ITEMS: \" + total)\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>4. View emails\u003C\u002Fh3>\u003Cp>Access URL: \u002FMEWebMail\u002FMondo\u002FServlet\u002Frequest.aspx\u003C\u002Fp>\u003Cp>Required key parameters:\u003C\u002Fp>\u003Cul>\u003Cli>Folder, which can be specified as inbox\u002Fsent\u002Fdrafts\u002Fdeleted\u002Fjunk\u003C\u002Fli>\u003Cli>ME_VALIDATIONTOKEN, obtained by accessing \u002Fmewebmail\u002FMondo\u002FServlet\u002Frequest.aspx?Cmd=GET-MBX-OPTIONS&amp;Scope=2 and retrieving from the response\u003C\u002Fli>\u003Cli>ID, obtained by sending a request to view the mailbox folder and retrieving from the response\u003C\u002Fli>\u003C\u002Ful>\u003Cp>The result is returned in XML format, containing detailed email content. If attachments exist, the EXISTS attribute of ATTACHMENTS is set to 1; if no attachments exist, the EXISTS attribute is set to 0.\u003C\u002Fp>\u003Cp>MESSAGEID serves as the identifier for attachments. If multiple attachments exist, they share the same MESSAGEID. FILENAME is the name of the attachment. MESSAGEID+FILENAME serves as the unique identifier for the attachment and must be used as a parameter when downloading attachments.\u003C\u002Fp>\u003Cp>To improve efficiency, xml.dom can be used to parse XML.\u003C\u002Fp>\u003Cp>An example of XML data is shown in the following figure.\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fuploads\u002Fdocx_image_1770017999999_5_e37e6fbddb.jpeg\">\u003C\u002Fp>\u003Cp>Python code for parsing XML to extract email information is as follows:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>DOMTree = minidom.parseString(r.text)\u003Cbr>collection = DOMTree.documentElement\u003Cbr>element = collection.getElementsByTagName(\"ELEMENT\")\u003Cbr>id = element[0].getAttribute(\"ID\")\u003Cbr>print(\"[+] ID      : \" + id)\u003Cbr>fromaddress = element[0].getElementsByTagName(\"FROM_ADDRESS\")\u003Cbr>print(\"    From    : \" + fromaddress[0].childNodes[0].data)\u003Cbr>to = element[0].getElementsByTagName(\"TO\")\u003Cbr>print(\"    To      : \" + to[0].childNodes[0].data)\u003Cbr>subject = element[0].getElementsByTagName(\"SUBJECT\")\u003Cbr>print(\"    Subject : \" + subject[0].childNodes[0].data)\u003Cbr>received = element[0].getElementsByTagName(\"RECEIVED\")\u003Cbr>print(\"    Received: \" + received[0].childNodes[0].data)\u003Cbr>\u003Cbr>body = element[0].getElementsByTagName(\"BODY\")\u003Cbr>if len(body[0].childNodes) &gt; 0:\u003Cbr>    print(\"    BODY    : \" + body[0].childNodes[0].data)\u003Cbr>\u003Cbr>attachments = element[0].getElementsByTagName(\"ATTACHMENTS\")\u003Cbr>exists =  attachments[0].getAttribute(\"EXISTS\")\u003Cbr>if exists == \"1\":\u003Cbr>    messageid = attachments[0].getElementsByTagName(\"MESSAGEID\")\u003Cbr>    print(\"    Attachments: \" + messageid[0].childNodes[0].data)\u003Cbr>    items = attachments[0].getElementsByTagName(\"ITEM\")\u003Cbr>    for item in items:\u003Cbr>        print(\" name:\" + item.getElementsByTagName(\"FILENAME\")[0].childNodes[0].data)\u003Cbr>        print(\" size:\" + item.getElementsByTagName(\"SIZE\")[0].childNodes[0].data)\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>5. Download Attachment\u003C\u002Fh3>\u003Cp>Access URL: \u002FMEWebMail\u002FMondo\u002Flang\u002Fsys\u002FForms\u002FMAI\u002FGetAttachment.aspx\u003C\u002Fp>\u003Cp>Required key parameters:\u003C\u002Fp>\u003Cul>\u003Cli>Folder, can be specified as inbox\u002Fsent\u002Fdrafts\u002Fdeleted\u002Fjunk\u003C\u002Fli>\u003Cli>MessageID, obtained from the response of the view email request\u003C\u002Fli>\u003Cli>Filename, obtained from the response of the view email request\u003C\u002Fli>\u003C\u002Ful>\u003Cp>When saving attachments, distinguish between text format and binary format\u003C\u002Fp>\u003Ch2>0x04 Open Source Code\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Complete code has been uploaded to GitHub, address as follows:\u003C\u002Fp>\u003Cp>An open source project\u003C\u002Fp>\u003Cp>The code supports the following functions:\u003C\u002Fp>\u003Cul>\u003Cli>GetVersion, version detection\u003C\u002Fli>\u003Cli>Check, login verification\u003C\u002Fli>\u003Cli>ListFolder, view folders, display email count in command line, save full content to file\u003C\u002Fli>\u003Cli>ViewMail, view emails, display email information in command line, save full content to file\u003C\u002Fli>\u003Cli>DownloadAttachment, download attachments\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>0x05 Summary\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>This article details the development of Python scripts for accessing MailEnable emails, with open-source code MailEnableManage.py, implementing version detection, login verification, folder viewing, email viewing, and email downloading functions\u003C\u002Fp>\u003C\u002Fbody>\u003C\u002Fhtml>","text","ltr","\u003Chtml>\u003Chead>\u003C\u002Fhead>\u003Cbody>\u003Ch2>0x00 Preface\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>MailEnable provides an end-to-end solution for delivering secure email and collaboration services. According to the official website: a recent independent survey reported MailEnable as the world's most popular Windows mail server platform.\u003C\u002Fp>\u003Cp>For the MailEnable developer API, I only found documentation for the AJAX API on the official website. Therefore, this article will attempt to write Python scripts to access MailEnable mail, document the development details, and open-source the code.\u003C\u002Fp>\u003Ch2>0x01 Introduction\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>This article will cover the following:\u003C\u002Fp>\u003Cul>\u003Cli>Environment Setup\u003C\u002Fli>\u003Cli>Development Details\u003C\u002Fli>\u003Cli>Open-source code MailEnableManage.py\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>0x02 Environment Setup\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Ch3>1. Installation\u003C\u002Fh3>\u003Cp>Before installation, IIS service and .NET 3.5 must be installed; otherwise, Web access cannot be configured properly.\u003C\u002Fp>\u003Cp>MailEnable download address: http:\u002F\u002Fwww.mailenable.com\u002Fdownload.asp\u003C\u002Fp>\u003Ch3>2. Configuration\u003C\u002Fh3>\u003Cp>Start MailEnableAdmin.msc, configure mail server information under MailEnable Management-&gt;Messaging Manager-&gt;Post Offices\u003C\u002Fp>\u003Cp>As shown below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fapi\u002Fmedia\u002Ffile\u002Fdocx_image_1770017970338_0_d3f40b2fa0-1.jpeg\">\u003C\u002Fp>\u003Cp>Default login page:\u003C\u002Fp>\u003Cp>http:\u002F\u002Fmewebmail.localhost\u002Fmewebmail\u002FMondo\u002Flang\u002Fsys\u002Flogin.aspx\u003C\u002Fp>\u003Ch3>3. Enable Web Management Page\u003C\u002Fh3>\u003Cp>Reference:\u003C\u002Fp>\u003Cp>http:\u002F\u002Fwww.mailenable.com\u002Fkb\u002Fcontent\u002Farticle.asp?ID=ME020132\u003C\u002Fp>\u003Cp>Start MailEnableAdmin.msc, select MailEnable Management-&gt;Servers-&gt;localhost-&gt;Services and Connectors-&gt;WebAdmin, right-click and choose Properties from the pop-up menu, select the Configure... button to install\u003C\u002Fp>\u003Cp>As shown below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fapi\u002Fmedia\u002Ffile\u002Fdocx_image_1770017979571_1_d905d79fce-1.jpeg\">\u003C\u002Fp>\u003Cp>Start MailEnableAdmin.msc, under MailEnable Management-&gt;Messaging Manager-&gt;Post Offices, select the configured Post Office, right-click and choose Properties from the pop-up menu, switch to the Web Admin tab, enable web administration\u003C\u002Fp>\u003Cp>As shown below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fapi\u002Fmedia\u002Ffile\u002Fdocx_image_1770017987478_2_9713e3a4ec-1.jpeg\">\u003C\u002Fp>\u003Cp>Select the specified user and modify the attributes to administrator\u003C\u002Fp>\u003Cp>Default management page:\u003C\u002Fp>\u003Cp>http:\u002F\u002Fmewebmail.localhost\u002Fmeadmin\u002FMondo\u002Flang\u002Fsys\u002Flogin.aspx\u003C\u002Fp>\u003Cp>\u003Cstrong>Note:\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>If the user's plaintext password is forgotten, you can check the Auth.tab file in the default installation path C:\\Program Files (x86)\\Mail Enable\\Config, which stores the plaintext password for each mailbox user\u003C\u002Fp>\u003Ch2>0x03 Development Details\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Ch3>1. Version Determination\u003C\u002Fh3>\u003Cp>After testing multiple versions, the summarized version determination method is as follows:\u003C\u002Fp>\u003Cp>Access the login page: http:\u002F\u002F\u003Curl>\u002Fmewebmail\u002FMondo\u002Flang\u002Fsys\u002Flogin.aspx\u003C\u002Furl>\u003C\u002Fp>\u003Cp>View the webpage source code, as shown in the figure below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fapi\u002Fmedia\u002Ffile\u002Fdocx_image_1770017993187_3_727ccf1002-1.jpeg\">\u003C\u002Fp>\u003Cp>In \u003Clink rel=\"stylesheet\" type=\"text\u002Fcss\" href=\"\u002FMEWebMail\u002FMondo\u002Fskins\u002FArctic\u002Fme.css?v=9.84\">, v=9.84 corresponds to the MailEnable version\u003C\u002Fp>\u003Cp>In script implementation, I adopted the following method:\u003C\u002Fp>\u003Col>\u003Cli>Find the position of ?v=\u003C\u002Fli>\u003Cli>Extract a fixed-length string backward\u003C\u002Fli>\u003Cli>Use \" as delimiter to obtain version number\u003C\u002Fli>\u003C\u002Fol>\u003Ch4>Supplement: Obtain version number via MailEnableAdmin.msc\u003C\u002Fh4>\u003Cp>Launch MailEnableAdmin.msc, select MailEnable Management-&gt;Servers-&gt;localhost-&gt;System-&gt;Diagnose\u003C\u002Fp>\u003Cp>As shown below\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fapi\u002Fmedia\u002Ffile\u002Fdocx_image_1770017996699_4_02ed28a68d-1.jpeg\">\u003C\u002Fp>\u003Cp>\u003Cstrong>Note: Version number list\u003C\u002Fstrong>\u003C\u002Fp>\u003Cp>http:\u002F\u002Fwww.mailenable.com\u002FPremium-ReleaseNotes.txt\u003C\u002Fp>\u003Cp>http:\u002F\u002Fwww.mailenable.com\u002FStandard-ReleaseNotes.txt\u003C\u002Fp>\u003Ch3>2. User login\u003C\u002Fh3>\u003Cp>Access URL: \u002Fmewebmail\u002FMondo\u002FServlet\u002Frequest.aspx\u003C\u002Fp>\u003Cp>Required key parameters:\u003C\u002Fp>\u003Cul>\u003Cli>txtUsername\u003C\u002Fli>\u003Cli>txtPassword\u003C\u002Fli>\u003Cli>loginParam\u003C\u002Fli>\u003C\u002Ful>\u003Cp>The result is returned in JSON format. If the login is successful, the value of bReportLoginFailure is False.\u003C\u002Fp>\u003Cp>The corresponding Python code is as follows:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>def Check(host, username, password):\u003Cbr>    url = host + \"\u002Fmewebmail\u002FMondo\u002FServlet\u002Frequest.aspx?Cmd=LOGIN&amp;Format=JSON\"\u003Cbr>\u003Cbr>    body = {\u003Cbr>            \"txtUsername\": username,\u003Cbr>            \"txtPassword\": password,\u003Cbr>            \"ddlLanguages\": \"en\",\u003Cbr>            \"ddlSkins\":\"Arctic\",\u003Cbr>            \"loginParam\":\"SubmitLogin\"\u003Cbr>            }  \u003Cbr>    postData = urllib.parse.urlencode(body).encode(\"utf-8\")           \u003Cbr>    headers = {\u003Cbr>        \"User-Agent\": \"Mozilla\u002F5.0 (X11; Linux x86_64; rv:52.0) Gecko\u002F20100101 Firefox\u002F52.0\",\u003Cbr>        \"Content-Type\": \"application\u002Fx-www-form-urlencoded\",    \u003Cbr>    }         \u003Cbr>    r = requests.post(url, headers=headers, data=postData, verify = False)\u003Cbr>    if r.status_code ==200 and r.json()[\"bReportLoginFailure\"] == False:\u003Cbr>        print(\"[+] Valid:%s  %s\"%(username, password))      \u003Cbr>    else:\u003Cbr>        print(r.status_code)\u003Cbr>        print(r.text)\u003Cbr>    r.close()\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>3. View email folders\u003C\u002Fh3>\u003Cp>Access URL: \u002FMEWebMail\u002FMondo\u002FServlet\u002Fasyncrequest.aspx\u003C\u002Fp>\u003Cp>Required key parameters:\u003C\u002Fp>\u003Cul>\u003Cli>Folder, which can be specified as inbox\u002Fsent\u002Fdrafts\u002Fdeleted\u002Fjunk\u003C\u002Fli>\u003Cli>ME_VALIDATIONTOKEN, needs to be obtained by accessing \u002Fmewebmail\u002FMondo\u002FServlet\u002Frequest.aspx?Cmd=GET-MBX-OPTIONS&amp;Scope=2, retrieved from the response\u003C\u002Fli>\u003C\u002Ful>\u003Cp>The response is in XML format, containing the number of all emails in the folder and brief content of each email. ID serves as the unique identifier for each email and is required as a parameter when reading emails\u003C\u002Fp>\u003Cp>To improve efficiency, you can use xml.dom to parse XML.\u003C\u002Fp>\u003Cp>Reference materials for parsing XML with xml.dom:\u003C\u002Fp>\u003Cp>https:\u002F\u002Fdocs.python.org\u002F3.8\u002Flibrary\u002Fxml.dom.minidom.html#xml.dom.minidom.parse\u003C\u002Fp>\u003Cp>Python code for parsing XML with xml.dom and extracting TOTAL_ITEMS:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>from xml.dom import minidom\u003Cbr>DOMTree = minidom.parseString(r.text)\u003Cbr>collection = DOMTree.documentElement\u003Cbr>total = collection.getAttribute(\"TOTAL_ITEMS\")\u003Cbr>print(\"[+] TOTAL_ITEMS: \" + total)\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>4. View emails\u003C\u002Fh3>\u003Cp>Access URL: \u002FMEWebMail\u002FMondo\u002FServlet\u002Frequest.aspx\u003C\u002Fp>\u003Cp>Required key parameters:\u003C\u002Fp>\u003Cul>\u003Cli>Folder, which can be specified as inbox\u002Fsent\u002Fdrafts\u002Fdeleted\u002Fjunk\u003C\u002Fli>\u003Cli>ME_VALIDATIONTOKEN, obtained by accessing \u002Fmewebmail\u002FMondo\u002FServlet\u002Frequest.aspx?Cmd=GET-MBX-OPTIONS&amp;Scope=2 and retrieving from the response\u003C\u002Fli>\u003Cli>ID, obtained by sending a request to view the mailbox folder and retrieving from the response\u003C\u002Fli>\u003C\u002Ful>\u003Cp>The result is returned in XML format, containing detailed email content. If attachments exist, the EXISTS attribute of ATTACHMENTS is set to 1; if no attachments exist, the EXISTS attribute is set to 0.\u003C\u002Fp>\u003Cp>MESSAGEID serves as the identifier for attachments. If multiple attachments exist, they share the same MESSAGEID. FILENAME is the name of the attachment. MESSAGEID+FILENAME serves as the unique identifier for the attachment and must be used as a parameter when downloading attachments.\u003C\u002Fp>\u003Cp>To improve efficiency, xml.dom can be used to parse XML.\u003C\u002Fp>\u003Cp>An example of XML data is shown in the following figure.\u003C\u002Fp>\u003Cp>\u003Cimg alt=\"Alt text\" src=\"\u002Fapi\u002Fmedia\u002Ffile\u002Fdocx_image_1770017999999_5_e37e6fbddb-1.jpeg\">\u003C\u002Fp>\u003Cp>Python code for parsing XML to extract email information is as follows:\u003C\u002Fp>\u003Ctable>\u003Ctbody>\u003Ctr>\u003Ctd>\u003Cp>DOMTree = minidom.parseString(r.text)\u003Cbr>collection = DOMTree.documentElement\u003Cbr>element = collection.getElementsByTagName(\"ELEMENT\")\u003Cbr>id = element[0].getAttribute(\"ID\")\u003Cbr>print(\"[+] ID      : \" + id)\u003Cbr>fromaddress = element[0].getElementsByTagName(\"FROM_ADDRESS\")\u003Cbr>print(\"    From    : \" + fromaddress[0].childNodes[0].data)\u003Cbr>to = element[0].getElementsByTagName(\"TO\")\u003Cbr>print(\"    To      : \" + to[0].childNodes[0].data)\u003Cbr>subject = element[0].getElementsByTagName(\"SUBJECT\")\u003Cbr>print(\"    Subject : \" + subject[0].childNodes[0].data)\u003Cbr>received = element[0].getElementsByTagName(\"RECEIVED\")\u003Cbr>print(\"    Received: \" + received[0].childNodes[0].data)\u003Cbr>\u003Cbr>body = element[0].getElementsByTagName(\"BODY\")\u003Cbr>if len(body[0].childNodes) &gt; 0:\u003Cbr>    print(\"    BODY    : \" + body[0].childNodes[0].data)\u003Cbr>\u003Cbr>attachments = element[0].getElementsByTagName(\"ATTACHMENTS\")\u003Cbr>exists =  attachments[0].getAttribute(\"EXISTS\")\u003Cbr>if exists == \"1\":\u003Cbr>    messageid = attachments[0].getElementsByTagName(\"MESSAGEID\")\u003Cbr>    print(\"    Attachments: \" + messageid[0].childNodes[0].data)\u003Cbr>    items = attachments[0].getElementsByTagName(\"ITEM\")\u003Cbr>    for item in items:\u003Cbr>        print(\" name:\" + item.getElementsByTagName(\"FILENAME\")[0].childNodes[0].data)\u003Cbr>        print(\" size:\" + item.getElementsByTagName(\"SIZE\")[0].childNodes[0].data)\u003C\u002Fp>\u003C\u002Ftd>\u003C\u002Ftr>\u003C\u002Ftbody>\u003C\u002Ftable>\u003Ch3>5. Download Attachment\u003C\u002Fh3>\u003Cp>Access URL: \u002FMEWebMail\u002FMondo\u002Flang\u002Fsys\u002FForms\u002FMAI\u002FGetAttachment.aspx\u003C\u002Fp>\u003Cp>Required key parameters:\u003C\u002Fp>\u003Cul>\u003Cli>Folder, can be specified as inbox\u002Fsent\u002Fdrafts\u002Fdeleted\u002Fjunk\u003C\u002Fli>\u003Cli>MessageID, obtained from the response of the view email request\u003C\u002Fli>\u003Cli>Filename, obtained from the response of the view email request\u003C\u002Fli>\u003C\u002Ful>\u003Cp>When saving attachments, distinguish between text format and binary format\u003C\u002Fp>\u003Ch2>0x04 Open Source Code\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>Complete code has been uploaded to GitHub, address as follows:\u003C\u002Fp>\u003Cp>An open source project\u003C\u002Fp>\u003Cp>The code supports the following functions:\u003C\u002Fp>\u003Cul>\u003Cli>GetVersion, version detection\u003C\u002Fli>\u003Cli>Check, login verification\u003C\u002Fli>\u003Cli>ListFolder, view folders, display email count in command line, save full content to file\u003C\u002Fli>\u003Cli>ViewMail, view emails, display email information in command line, save full content to file\u003C\u002Fli>\u003Cli>DownloadAttachment, download attachments\u003C\u002Fli>\u003C\u002Ful>\u003Ch2>0x05 Summary\u003C\u002Fh2>\u003Cp>---\u003C\u002Fp>\u003Cp>This article details the development of Python scripts for accessing MailEnable emails, with open-source code MailEnableManage.py, implementing version detection, login verification, folder viewing, email viewing, and email downloading functions\u003C\u002Fp>\u003C\u002Fbody>\u003C\u002Fhtml>",1036,"Onedaysec",5,"published","2026-02-02T07:51:00.062Z",{"title":37,"description":14,"keywords":38,"ogImage":39,"canonicalUrl":39,"noIndex":40},"MailEnable Python Development Guide: API Access & Scripting","MailEnable, Python development, email server, API access, Windows mail server, webmail, scripting, open-source",null,false,[],{"docs":43,"hasNextPage":40},[4,44,45,46],540,539,538,{"title":39,"description":39,"image":39},"2026-07-24T15:37:12.840Z","2026-07-23T16:01:42.521Z","draft","2026-07-23T16:13:09.167Z"]