EmiaCtrlLite | Emia4Win | DecMsgX | DecMime

DecMime (decmime.exe(ver. 0.2))Documentation 2002-09-21 | Back



Decmime- Binary attachment decoder(decmime.exe) for decoding MIME attachments.

DecMime (c) 2001-2003 Jeremy Aiyadurai. All Rights Reserved. DecMime is free software in the sense that you are free to download, copy and redistribute it, provided that the copyright notice is retained in the copy. You are not allowed to charge a fee for the software without the consent of the author other than that to cover the cost of the distribution. If a fee is charged it must be made clear to the purchaser that the software is freeware and that the fee is to cover the distributor's costs of providing the software.
The DecMime software is provided as is without any warranty of any kind. The entire risk arising out of the use or performance of this product and documentation remains with recipient. To the maximum extent permitted by applicable law, in no event shall program DecMime or its suppliers be liable for any consequential, incidental, direct, indirect, special, punitive, recursive, or other damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, personal injury, disruption of family life, or other pecuniary loss) arising out of this agreement or the use of or inability to use the product DecMime.



[TOP]DecMime Syntax

DecMime is a utility for decoding Mime attachments. It will output the binary files to the directory specified using the /out: switch. The Text.txt file created will be the message from the multi-part message. Please Note, at this time, DecMime can only decode binary attachments, ascii attachments are not supported.

Retrieve Syntax (Decode while retrieving):

decmime* get /svr:[ s ] /port:[ p ] /id:[ i ] /pass:[ pw ] /msg:[ n ] /DEL:[ d ] ] /OUT:[dir]

i: username
pw: password
n: message #
d: 0 = keep (keep message on server), 1 = delete (remove message from server)

dir: folder to store decoded messages in.

Decode Syntax :

decmime* decode /src:[s]

MESSAGE.# file. the decoded entity is saved under ../mail/[uid]/MESSAGE.#.attach/

NOTE: decmime only works with Emia4Win, and not any older versions if Emia.

[TOP] DecMime version History

version 0.1
-first release
-decodes message while retrieving
version 0.2
-added command to decode already downloaded MESSAGE.# files

[TOP]Decoding MIME attachments via perl/CGI

Retrieve a MIME example

use CGI;

my $formmail = new CGI;

$| = 1;


sub getmsg {
my $Decmimepath = "..//decmime.exe";
my $pop3server = "mail.host.com";
my $username = "John";
my $password = "mylittlesecret";
my $action = "message" # we are going to retrieve a message
my $msgnum = "1"; # the message number
my $DELETE = "0"; #(Delete from server) switch. 1=delete 0=remain
my $out = "C://Mail/Att" # (output file dir)

open(MSG,"$Decmimepath get /port:110 /svr:$pop3server /id:$username /pass:$password /msg:$msgnum /DEL:$DELETE /out:$out"."|") || die("Could not execute \"$Decmimepath\"");

print $formmail->header('text/html');
print "<body>";
open(T "$out/Text.text");
print "$_<br>";
print "</p></body\n";
print $formmail->end_html;


[TOP]Decoding MIME attachments via PHP

N/A No example available at this time

[TOP]Decoding MIME Attachments via Python

import os

output= os.popen('decmime get /svr:mail.host.com /port:110 /id:noneofyourbiz /pass:likeiwould /a:message /msg:1 /DEL:0 /out:C:\temp','r')


[TOP]DecMime for VBScript/VBA/ASP Overview


DecMime supports VBScript/VBA/ASP, by deploying a component DLL that takes care of the processes.
Download EmiaVBS_A.dll here.It requires that you have the Microsoft .NET Framework Redistributable installed. *EmiaVBS_A.dll is not standalone. It requires Emia4Win (emia.exe) and DecMime (decmime.exe)
Once installed, you must register the component by typing at the console "regasm EmiaVBS_A.dll /tlb /codebase"
Please Note: In order to use EmiaVBS_A with ASP on IIS, you must set "Application Protection" to "Low" and "Execute Permissions" to "Scripts only" or "Scripts and Executables" under the "Home Directory" Tab in website properties.
*NOTE: EmiaVBS_A.dll is only to be used with Emia4Win and/or DecMime. If you plan to use Emia4Win with/or DecMsgX, you must use EmiaVBS_B.

Basic Methods (SendRetrieve) CreateObject("EmiaVBS_A.SendRetrieve")
void mail(string server,int port,string sender,string recipient,string message,string emiapath)
INFO = sends message
string list(string server,int port,string id,string pass,string emiapath)
INFO = returns messages info list from pop3 server
eg. From&|&Subject&|&Size&|&Date&|&Number&|&Attach
string listSlice(string server,int port,string id,string pass,string slice,string emiapath)
INFO = returns messages info list for numbers given by slice from pop3 server. eg. if slice = "1-20", only message info for messages 1 through 20 will be listed and displayed
eg. From&|&Subject&|&Size&|&Date&|&Number&|&Attach
string message(string server,int port,string id,string pass,string msgnum,int DEL,string emiapath)
INFO = Returns message
void delete(string server,int port,string id, string pass, string msgnums,string emiapath)
INFO: removes specified messages from server, then updates the active list (LIST)
void all(string server, int thePortNum, string id, string pass,string uid,string emiapath)
INFO: downloads list,stat and all messages to default location /mail/[uid]
void allAppend(string server, int thePortNum, string id, string pass,string uid,string emiapath)
INFO: appends to the list,stat and downloads only new messages to default location /mail/[uid]
void bl(string src,string emiapath)
INFO: Build local list (LLIST) and local stat (LSTAT) from downloaded MESSAGE.# files
void blChunk(string src,string chunk,string emiapath)
INFO: Build local list's (LLIST.X) and local stat (LSTAT) from downloaded MESSAGE.# files
void rmv(string src,int messagenum,string emiapath)
INFO: Delete messages (MESSAGE.\#) from disk
void mimeDecodeDownload(string server, int thePortNum, string id, string pass, int msgnum,int DEL,string outputdir,string decmimepath)
INFO: Decode while retrieving MIME messages
void mimeDecodeStored(string src,string decmimepath)
INFO: Decode stored MIME messages
Advanced Methods (Chain) CreateObject("EmiaVBS_A.Chain")
void Config(string thechainID,string theserver, int thePortNum, string theid, string thepass,string Emia4winpath/Decmimepath)
void ConfigD(string thechainID,string theserver, int thePortNum, string theid, string thepass,string outputdir,string Emia4winpath/Decmimepath)
void addGetStat()
void addGetList()
void addGetListChunk(int chunk)
void addGetMessage(int msgnum,int DEL)
void addGetAll()
void addGetAllAppend()
void addrmv(int num)
void addDel(string msgnums)
void addBL()
void addBLChunk(int chunk)
void Exec()



© 2002/2003 Jeremy Aiyadurai . All Rights Reserved