EmiaCtrlLite | Emia4Win | DecMsgX | DecMime

Emia4Win (emia.exe)Documentation 2004-11-25 | Back

 

Description:

Emia4Win is a bare-bone command line driven IMAP/POP3/SMTP package for sending and retrieving electronic mail. It can be used as a utility/component with the intent to give Web/Internet Applications, Email Capabilities. It can be incorporated into any application regardless of what language is used. Primary purpose is to to make it easier and faster for a developer to create a full fledged webmail application, or on a small scale with limited budget or resources.

COPYRIGHT
Emia4Win (c) 2001-2005 Jeremy Aiyadurai. All Rights Reserved.

TERMS OF USE

You have the right to freely use Emia4Win only if it is to be used personally or in a non-profit organization. You are NOT to freely use Emia4win commercially ( where financial profits can be made ). To commercially use this software, an agreement must be made between the "commercial entity" and the "author".
The agreement is a license allowing the commercial entity to use Emia4Win for commercial purposes. Please contact author Jeremy Aiyadurai (jeremygwa@hotmail.com ) for further information regarding a commercial license.

DISCLAIMER
TheEmia4Win 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 Emia4Win 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 Emia4Win.

TOC

[TOP]Emia Syntax

[TOC] SMTP Send Syntax:

emia [--mse] snd /svr:[ s ] /port:[ p ] /se:[ s@a ] /re:[ r@a ]
[ hdrs&message ]
#ENDOM

*Note - Special Syntax required for Window's mail-servers.: --mse: flag for communicating with MS Exchange Server.

s: Mail Server eg. mail.host.com
p: Port number of the Mail Server eg. 25
s@a: Sender@Address
r@a: Recipient@Address
hdrs&message: Headers & Message Body
#ENDOM: END-Of-Message terminator (sends message then exits)

[TOC] POP3 Retrieve Syntax:

emia
[--mse] get /svr:[s] /port:[p] /id:[i] /pass:[pw] /a:[a] (ARGS)

*Note - Special Syntax required for Window's mail-servers.: --mse: flag for communicating with MS Exchange Server.

s: POP3 mail server (eg: mail.domain.com)
p: POP3 port number of POP3 server eg. 110
i: POP3 username
pw: POP3 password

a: list,message,stat,all

list
ARGS = [ /slice:[s] ]
INFO = displays messages info list
eg. From&|&Subject&|&Size&|&Date&|&Number&|&Attach

-optional args:
s: a slice of the list to show
eg: '1-20' (without single quotes) displays list of message info for
messages 1 through 20 as numbered on the server

message
ARGS = /msg:[n] /DEL:[D]
INFO = Retrieves and displays message
n: message number
- optional args:
D: delete message = 1
keep on server = 0

stat
ARGS = N/A
INFO = displays message total & box size


all
ARGS = /uid=[id] [ /out:[outputdir] append ]
INFO = downloads list,stat and all messages to default location /mail/[id]
id: tag to associate with mailbox
- optional args:
outputdir: eg c:/mailbox
append: append to MESSAGES.\# and list instead of re-downloading all

[TOC] IMAP Retrieve and Management Syntax:

emia [--mse] imap /svr:[s] /port:[p] /id:[i] /pass:[pw] [/box:[b]] /a:[a] (ARGS)

*Note - Special Syntax required for Window's mail-servers.: --mse: flag for communicating with MS Exchange Server.

s: IMAP mail server (eg: mail.domain.com)
p: IMAP port number of IMAP server eg. 143
i: IMAP username
pw: IMAP password
a: list,message
- optional args:
b: online mailbox name, (if ommitted, default = "INBOX")

create
ARGS = /boxname:[b]
INFO = creates a new mailbox for account
b: name for box

boxlist
ARGS = N/A
INFO = list of mailboxes for account

delbox
ARGS = /boxname:[b]
INFO = deletes specified mailbox from server
b: name of the box to delete

delmsgs
ARGS = [ /msg:[[n],n...]] [ /EXPUNGE/ ]
INFO: deletes and purges messages in the current box
n: message number(s)
EXPUNGE = purge messages marked for deletion

copy
ARGS = /msg:[[n],n...] /destbox:[d]
INFO = copy's message from current box to another
n: message number(s)
d: destination box on server

backup
ARGS = /boxname:[b]
INFO = Backs up selected box
b = box name to backup

stat
ARGS = N/A
INFO = displays message total & box size

list
ARGS = [ /slice:[s] ] [ flags ]
INFO = displays messages info list
eg. From&|&Subject&|&Size&|&Date&|&Number&|&Attach
- optional args:
s: a slice of the list to show
eg: "1-20" displays list of message info for
messages 1 through 20 as numbered on the server
flags: show IMAP FLAGS along with message info.

message
ARGS = /msg:[n] /DEL:[D]
INFO = Retrieves and displays message
n: message number
- optional args:
D: delete message (mark it) = 1
keep on server (mark it) = 0

[TOC] POP3 Advanced Syntax

(Chain) User Defined ordered list of commands

Chain Config Syntax

emia [--mse] chain [uid=[uid] /svr:[s] /port:[p] /id:[i] /pass:[pw] [/out:[dir]]]

*Note - Special Syntax required for Window's mail-servers.: --mse: flag for communicating with MS Exchange Server.

uid: tag to associate with mailbox eg. /mail/[uid]
s: POP3 mail server (eg: mail.domain.com)
p: POP3 port number of POP3 server eg. 110
i: POP3 username
pw: POP3 password
- optional args:
dir: change default output dir eg c:/mailbox

Chain Commands []

[ get /a:all [append] ]
INFO: downloads list,stat and all messages to default location /mail/[uid]
uid: tag to associate with mailbox
- optional args:
append: simply appends to the list of messages (MESSAGE.\#)
under root /mail/[uid] instead of re-downloading every message.

[ get /a:list [ /chunk:[c] ] ]
INFO = downloads list to default location /mail/[uid]
- optional args:
c: number of list headers per file eg. ( List.1,List.2, etc)

[ get /a:stat ]
INFO = downloads stat to default location /mail/[id]

[ get /a:message /msg:[m] /DEL:[D] ]
INFO = downloads specified message to default location /mail/[uid]
m: message number
D: delete message = 1
keep on server = 0

[ del /msg:[[n],n...] ]
INFO: removes specified msgs (n) from server, then updates the active list (LIST)
n: a number or "all" to remove all messages

[ bl [ /chunk:[c] ] ]
INFO: builds local list (LLIST) and local stat (LSTAT) from Downloaded MESSAGE.\# files.

- optional args:
c: number of list headers per file eg. ( LLIST.1,LLIST.2, etc)


[ rmv /msg:[[n],n...] ]
INFO: deletes specified MESSAGE.\# from disk, then renames all MESSAGEs in sequential order and then rebuilds LLIST and LSTAT
n: MESSAGE numbers to remove from disk

Chain example:

eg: emia chain [uid=me /svr:mail.host.com /port:110 /id:myid /pass:mypass /out:mailbox] [get /a:list] [get /a:stat] [get /a:message /msg:1 /DEL:0] [del msg:1,2,3]


The above example will download the list to the LIST file,stat to the STAT file, and message No.# 1 to the MESSAGE.1 file all which reside under /mailbox/mail/me/ root. The last chain command will mark messages 1,2 and 3 for deletion off the mail server.

[TOC] Misc. Syntax:

Delete messages from server then updates the active list (LIST)

Del Syntax:

emia
[--mse] del /svr:[s] /port:[p] /id:[i] /pass:[pw] /msg:[[n],n ...]

*Note - Special Syntax required for Window's mail-servers.: --mse: flag for communicating with MS Exchange Server.

s: POP3 mail server (eg: mail.domain.com)
p: POP3 port number of POP3 server eg. 110
i: POP3 username
pw: POP3 password
n: message number(s) or "all" to remove all messages

Delete messages (MESSAGE.\#) from disk

Del Syntax

emia rmv /src:[src] /msg:[n]

src: soure path to file eg "mail/[iud]"
n: message number eg: 1 = MESSAGE.1


Build local list (LLIST) and local stat (LSTAT) from downloaded MESSAGE.# files

Build Syntax:

emia bl /src:[src] [ /chunk:[c] ]

src: soure path eg "mail/[uid]"

c: number of list headers per file eg. ( LLIST.1,LLIST.2, etc)

[TOP] ASE.ini (Anti-Spam-Engine)

Emia4Win comes with a "Spam Alert" System. below is a sample configuration for dealing with Spam.

----ASE.ini-----
%RegStart
SUBKW=free,hot,sex,win
SIZEB=15000
EADDRESS=
EHOST=hotmail.com
%RegEnd

---------------

SUBKW: This line is for keywords that would appear in the subject header of possible spam messages. Each keyword is delimited by a comma.
SIZEB: Suppose you want to be alerted about messages that are over certain size, put the size in bytes here.
EADDRESS: This line is for email addresses of possible spammer's. Each address is delimited by a comma.
EHOST: This line is for email suffix'es. eg, if you want to be alerted about spam from "hotmail" addresses. Each suffix is delimited by a comma.

[TOP] Emia4Win Version History

version 2002.04.26
-first release
-Totally revamped version of emia
-attachment detection
-DecMime, a MIME attachment decoder
version 2002.08.15
-new bug fixes
-improved attachment detection
version 2002.08.18
-added stat action (/a:)
-added explicit multi delete message function
version 2002.09.06
-added advanced commands (chain) user defined orderd list of commands
-added all action (/a:) which retrieves the entire mailbox (MESSAGE.#'s, STAT, and LIST)
-Fixed major LIST function bug, hopefully now it is STD53 compliant
version 2002.09.18
-added all action (/a:) "append" flag
fixed del bug, now you can multiple delete in a chain
-added "all" flag to del function for deleting all messages on server
-added "bl" functionality which builds local list (LLIST) and local stat (LSTAT) files from analyzing downloaded MESSAGEs
-added "rmv" functionality which removes a specified MESSAGE.# file from disk, then renames all downloaded MESSAGEs sequentially and rebuilds local list (LLIST) and local stat (LSTAT) files.
version 2002.09.21
-improved "del" function performance
-fixed "del" function "all" bug
version 2002.09.25
-added threading (forked subprocess) support for chains, for doing more than one chain in one step, (alpha testing stage)
-fixed non chain "del" bug
-added(changed) optional args to "/uid=" and "/out:" for non chain "del"
version 2002.10.02
-fixed Major Message retrieval bug .
version 2003.03.05
-Fixed chain "del" and "rmv" bug
-added "/slice:" option to "get" command, and "/chunk:" option to chain command
-added simple spam detection (ASE.ini)
version 2003.03.18
-fixed list message subject header bug
version 2003.04.04
-added "/chunk:" option to "bl" commmand
version 2003.04.09
- removed all "/chunk:" bugs
version 2003.06.10
- removed some minor bugs
version 2003.06.21
- removed a major bug
version 2003.07.08
- fixed "/rmv:" bug
version 2003.08.14
- major update, IMAP functionality addition.
-EmiaCom (emiacom.dll) open source COM component library introduced

-version 2003.10.08
- fixed "bl" error-
version 2003.10.27
- fixed "ASE" error
version 2003.10.30 Download
- fixed bl functionality and compatibility bug
version 2004.11.25 Download
- fixed connection bug. *Now fully MS-Exchange Compatible*

[TOP] (Trouble Shooting)


  • Can Emia4win be used with any language?

Emia4win will work well with any language that supports pipes, where the programming can send or read data to or from another process.

 

  • How is it that when I try to retrieve,decode or check mail, Emia/DecMime hangs?
The problem can be caused by Antivirus Software which may be monitoring your pop3 port to check incoming messages for for viruses. If you have McAfee or Nortons Antivirus, disable email monitoring.
This problem can also be caused by certian firewall products.

 

  • ...regarding retrieving a message from the server - is there anyway to control what headers are shown?
The original intentions were to let the developer pick and choose the headers. You can do this with the help of Regex's (Regular Expressions) to parse the message, in order to control what headers the user may view. If you are using VB-Script, you can visit MSDN, where I found information about using Regular Expressions with VB-Script
here is the link:

http://msdn.microsoft.com/library/default.asp?URL=/library/en-us/dnclinic/html/scripting051099.asp


[TOP]Sending Mail via perl/CGI

[TOP]

example code snippet

$| = 1;

my $emia = "../emia.exe";
my $mailserver = "mail.host.com";
my $senderEmail = "sender\@office.com";
my $recipientEmail = "recip\@home.com";

SendMail();

sub SendMail {
open(MAIL,"|"."$emia snd /port:25 /svr:$mailserver /port:25 /se:$senderEmail /re:recip\@home.com") || die("Could not execute \"$Emiapath\"");

print MAIL "$message\n";
print MAIL "#ENDOM\n";
close(MAIL);

}

[TOP]Checking Mail via perl/CGI

Check Mail example

use CGI;

$| = 1;

my $formmail = new CGI;

checkmail();

sub checkmail {
my $Emiapath = "../emia.exe";
my $pop3server = "mail.host.com";
my $username = "John";
my $password = "mylittlesecret";
my $action = "list"; # "list" mail header information from messages
my @list; # array of hashes
open(MAIL,"$Emiapath /get /port:110 /svr:$pop3server /id:$username /pass:$password /a:$action|") || die("Could not execute \"$Emiapath\"");
print $formmail->header('text/html');
print "<body><table width=\"600\">";
while(<MAIL>){
my ($from,$subject,$size,$date,$number,$att) = split(/&\|&/,$_);
print "<tr>
<td>$from</td>
<td>$subject</td>
<td>$size</td>
<td>$data</td>
<td>$number</td>
</tr>\n";
# the following is an example on how you can store message info in an array.
push(@list,{ 'Sender' => $from, 'Subject' => $subject, 'Size' => $size, 'Date' => $date, 'Number' => $number, 'Attach' => $att,});
}
close(MAIL);
print "</table></body\n";
print $formmail->end_html;
}

[TOP]Retrieving Mail via perl/CGI

Retrieve a Message example

use CGI;

my $formmail = new CGI;

$| = 1;


getmsg();

sub getmsg {
my $Emiapath = "../emia.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

open(MSG,"$Emiapath get /port:110 /svr:$pop3server /id:$username /pass:$password /a:$action /msg:$msgnum /DEL:$DELETE"."|") || die("Could not execute \"$Emiapath\"");
print $formmail->header('text/html');
print "<body>";
while(<MSG>){
print "$_<br>";
}
close(MSG);
print "</p></body\n";
print $formmail->end_html;
}

 

[TOP]Deletion of Mail while retrieving it off server via perl/CGI

Deletion example

use CGI;

my $formmail = new CGI;

$| = 1;


getmsg();

sub getmsg {
my $Emiapath = "../emia.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 = "1"; #(Delete from server) switch. 1=delete 0=remain

open(MSG,"$Emiapath get /port:110 /svr:$pop3server /id:$username /pass:$password /a:$action /msg:$msgnum /DEL:$DELETE"."|") || die("Could not execute \"$Emiapath\"");
print $formmail->header('text/html');
print "<body>";
while(<MSG>){
print "$_<br>";
}
close(MSG);
print "</p></body\n";
print $formmail->end_html;
}

 

[TOP]Explicitly delete Mail off server via perl/CGI

Deletion example

use CGI;

my $formmail = new CGI;

$| = 1;


delmsgs();

sub delmsgs {
my $Emiapath = "../emia.exe";
my $pop3server = "mail.host.com";
my $username = "John";
my $password = "mylittlesecret";
my $msgnums = "1,2,3"; # the messages to delete,

system(MSG,"$Emiapath del /port:110 /svr:$pop3server /id:$username /pass:$password /msg:$msgnum"."|") || die("Could not execute \"$Emiapath\"");

close(MSG);
}

[TOP]Explicitly Check the mail box STAT via perl/CGI

Deletion example

use CGI;

my $formmail = new CGI;

$| = 1;


delmsgs();

sub delmsgs {
my $Emiapath = "../emia.exe";
my $pop3server = "mail.host.com";
my $username = "John";
my $password = "mylittlesecret";
my $action = "stat";

system(STAT,"$Emiapath get /port:110 /svr:$pop3server /id:$username /pass:$password /a:$action"."|") || die("Could not execute \"$Emiapath\"");
my $stat = <STAT>;
close(STAT);
}

...

[TOP]Emia for VBScript/VBA/ASP Overview

 

Emia4win now supports VBScript/VBA/ASP/ASP.NET, by deploying a component DLL that takes care of the processes we call "EmiaCom". It requires that you have the Microsoft .NET Framework Redistributable installed. *EmiaCom.dll is not standalone. It requires Emia4Win (emia.exe). Once installed, you must register the component by typing at the console "regasm EmiaCom.dll /tlb /codebase"

Please Note: In order to use EmiaCom 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.

EmiaCom.dll Copyright and Disclaimer (GNU Lesser General Public License).

Name: EmiaCom Version 1.0. Description: library to be used with Emia (Emia4win)/ DecMsgX / DecMime.
Copyright (C) 2002/2003 Jeremy Aiyadurai

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Download the open source EmiaCom.dll package here

 

METHODS for POP (Retrieving,Checking and Deleting Mail)
ProgID = "EmiaCom.POP"

  • void set_POP(string server,int pport,string uid,string pwd,string pathtoexe,string mailroot)
  • string stat_POP
  • string list_POP
  • string listSlice_POP(string slice*)
  • string message_POP(int msgnum,int DEL)
  • void allAppend_POP(string uid)
  • void all_POP(string uid)
  • void delete_POP(string msgnums*)
  • void bl(string src)
  • void blChunk(string src,string chunkSize)
  • void rmv(string src,string messagenum)

*slice eg. ( "1-5" etc)
*msgnums eg. ("1,2,3" etc)

Chain Methods(For advanced POP Transactions)
ProgID = "EmiaCom.Chain"

  • void ConfigChain(string thechainID,string theserver, int thePortNum, string theid, string thepass,string path)
  • void ConfigDChain(string thechainID,string theserver, int thePortNum, string theid, string thepass,string outputdir,string path)
  • void addGetStat()
  • void addGetList()
  • void addGetListChunk(int chunk*)
  • void addGetMessage(int msgnum,int DEL)
  • void addGetAll()
  • void addGetAllAppend()
  • void addRmv(string num)
  • void addDel(string msgnums)
  • void addBL()
  • void addBLChunk(int chunk*)
  • void Exec()*

*chunk eg. for lists of 5 headers, do 5
*Exec, this method executes the transaction

METHODS for IMAP(Functionality and Management)
ProgID = "EmiaCom.IMAP"

  • void set_IMAP(string server,int pport,string uid,string pwd,string pathtoexe)
  • string get_message_IMAP(string msgnum,int DEL)
  • string get_list_IMAP(string mbox,string Slice)
  • string get_box_list_IMAP()
  • string get_stat_IMAP(string mbox)
  • string create_box_IMAP(string mbox)
  • string del_box_IMAP(string mbox)
  • string del_msgs_IMAP(string msgnums,string mbox,bool EXP)
  • string copy_msgs_IMAP(string destbox, string msgnums, string mbox)
  • backup_IMAP(string mbox)
[TOP]Sending Mail via VBScript/ASP

example code snippet
...

dim mailserver,SMTPPort,sender,recipient,message,mailer,emiapath
mailserver = "mail.host.com"
newline = chr(13)
SMTPPort = 25
sender = "jon@host.com"
recipient = "justin@host.com"
message = "this is a test"+newline+"123"
emiapath = "."

set mailer = CreateObject("EmiaCom.legacy")
Call mailer.mail(mailserver,SMTPPort,sender,recipient,message,emiapath)


...
ASP EXAMPLE
<html>
<head>
sendmail
</head>
<body>
<%

dim mailserver,emiapath,mailer
mailserver = "mail.host.com"
emiapath = "C:\Inetpub\wwwroot"
Set mailer = Server.CreateObject("EmiaCom.legacy")
call mailer.mail(mailserver,25,"him@home.com","her@office.com","this is a test",emiapath)
%>
</body>
</html>


[TOP]Checking Mail via VBScript/ASP

Check mail example snippet
...

Option Explicit

dim mailserver,port,id,pass,mail,list,emiapath
mailserver = "mail.host.com"
port = 110
id = "itsasecret"
pass = "itisalsoasecret"
list = vbString
emiapath = "."
Set mail = CreateObject("EmiaCom.POP")
mail.set_POP mailserver,port,id,pass,emiapath,"c:\emiamail"
list = mail.list_POP
WScript.Echo ""+list



...
ASP EXAMPLE

<html>
<head>
pop3 list
</head>
<body>

<table width="90%" border="1" align="center">
<%


dim mailserver,port,id,pass,mail,list,emiapath
mailserver = "mail.host.com"
port = 110
id = "itsasecret"
pass = "itisalsoasecret"
list = vbString
emiapath = "."
Set mail = CreateObject("EmiaCom.POP")
mail.set_POP mailserver,port,id,pass,emiapath,"c:\emiamail"
list = mail.list_POP
dim listlines

Set R1 = New RegExp

With R1
.Pattern = "\n"
.IgnoreCase = True
.Global = True
End With

dim data,stripnewlines


stripnewlines = R1.Replace(list, "|||")
Set RegularExpressionObject = nothing


listlines = split(stripnewlines,"|||")

for each p in listlines
Response.Write("<tr>")
data = split(p,"&|&")
for each d in data
Response.Write("<td>"+d+"</td>")
next
Response.Write("</tr>")
next
%>
</table>
</body>
</html>

[TOP]Retrieving Mail via VBScript/ASP

Retrieve message example snippet
...
Option Explicit

dim mailserver,port,id,pass,mail,message,msgnum,DEL,EMIAPATH
mailserver = "mail.host.com"
port = 110
id = "none"
pass = "none"
message = vbString
msgnum = 5
DEL = 0
EMIAPATH = "."
Set mail = CreateObject("EmiaCom.POP")
mail.set_POP mailserver,port,id,pass,EMIAPATH,""
message = mail.message_POP(msgnum,DEL)
WScript.Echo ""+message



...
ASP EXAMPLE
<%
Dim mailserver,pop3user,pop3pass,port,action,DEL,msgnum,mail,newline,EMIAPATH
EMIAPATH = "C:/Inetpub/wwwroot/"
mailserver = "mail.host.com"
pop3user = "likeiwould"
pop3pass = "***"
port = 110
action = "message"
msgnum = "3"
newline = chr(13) & Chr(10)
DEL = "0" ' 0 == keep, 1 == delete off server
Set mail = CreateObject("EmiaCom.POP")
mail.set_POP mailserver,port,pop3user,pop3pass,EMIAPATH,""
dim message,messagelines
message = mail.message_POP(msgnum,DEL)

messagelines = split(message,newline)
%>
<body>
<BLOCKQUOTE>
<%
'Response.Write(message)
for each line in messagelines
if line <> "" then
Response.Write(line+"<br>")
end if
next
%>
<BLOCKQUOTE>
</body>


[TOP]Checking STAT via VBScript/ASP

...

Option Explicit

dim mailserver,port,id,pass,mail,sstat,EmiaPath
mailserver = "mail.host.com"
port = 110
id = "uhavetoguess"
pass = "***"
sstat = vbString
EmiaPath = "."
Set mail = CreateObject("EmiaCom.POP")
mail.set_POP mailserver,port,id,pass,EmiaPath,""
sstat = mail.stat_POP
WScript.Echo ""+sstat

...
ASP EXAMPLE
<%dim mailserver,port,id,pass,mail,sstat,EmiaPath
mailserver = "mail.host.com"
port = 110
id = "uhavetoguess"
pass = "***"
sstat = vbString
EmiaPath = "C:/Inetpub/wwwroot/"
Set mail = CreateObject("EmiaCom.POP")
mail.set_POP mailserver,port,id,pass,EmiaPath,""
sstat = mail.stat_POP

Response.Write("<p>"+sstat)
%>

[TOP]Deletion of Mail off server via VBScript/ASP

Deletion example snippet
...
Option Explicit

dim mailserver,port,id,pass,mail,msgnums,EmiaPath
mailserver = "mail.host.com"
port = 110
id = "youhavetoguess"
pass = "guesstoo"
msgnums = "1,2"
EmiaPath = "."
Set mail = CreateObject("EmiaCom.POP")
mail.set_POP mailserver,port,i,pass,EmiaPath,""
mail.delete_POP msgnums

...
ASP EXAMPLE
<% Option Explicit

dim mailserver,port,id,pass,mail,msgnums,EmiaPath
mailserver = "mail.host.com"
port = 110
id = "youhavetoguess"
pass = "guesstoo"
msgnums = "1,2"
EmiaPath = "C:/Inetpub/wwwroot/"
Set mail = CreateObject("EmiaCom.POP")
mail.set_POP mailserver,port,i,pass,EmiaPath,""
mail.delete_POP msgnums

%>

[TOP]Sending Mail via PHP

 

...

<?php
$senderaddress = "me@host.com";
$recipaddress = "her@host.com";

$f = popen('emia snd /svr:mail.host.com /port:25 /se:'.$senderaddress.' /re:'.$recipaddress.' 2>&1', 'w');
//set_file_buffer($f, 0);
fflush($f);
fputs($f,"message headers and body go here");
fputs($f,"\n#ENDOM\n");
pclose($f);
?>



...

[TOP]Checking Mail via PHP


...

<?php
$id = "noneofyourbiz";
$pass = "sameastheabove";

$fp = popen('emia get /svr:mail.host.com /port:110 /id:'.$id.' /pass:'.$pass.' /a:list 2>&1', 'r');
fflush($fp);
while (!feof ($fp)) {
$buffer = fgets($fp,4096);
?>
<p>
<?php
print $buffer;
?>
</p>
<?php
}
pclose($fp);



...

[TOP]Retrieving Mail via PHP

...
<?php

$id = "noneofyourbiz";
$pass = "sameastheabove";

$fp = popen('emia get /svr:mail.host.com /port:110 /id:'.$id.' /pass:'.$pass.' /a:message /msg:1 /DEL:0 2>&1', 'r');
fflush($fp);
while (!feof ($fp)) {
$buffer = fgets($fp,4096);
?>
<br>
<?php
print $buffer;
}
pclose($fp);
?>

...

[TOP]Deletion of Mail while retrieving it off server via PHP

...
<?php

$id = "noneofyourbiz";
$pass = "sameastheabove";

$fp = popen('emia get /svr:mail.host.com /port:110 /id:'.$id.' /pass:'.$pass.' /a:message /msg:1 /DEL:1 2>&1', 'r');
fflush($fp);
while (!feof ($fp)) {
$buffer = fgets($fp,4096);
?>
<br>
<?php
print $buffer;
}
?>

...

[TOP]Explicitly check the STAT via PHP

...
<?php

$id = "noneofyourbiz";
$pass = "sameastheabove";

$fp = popen('emia get /svr:mail.host.com /port:110 /id:'.$id.' /pass:'.$pass.' /a:stat 2>&1', 'r');
fflush($fp);
while (!feof ($fp)) {
$buffer = fgets($fp,4096);
?>
<br>
<?php
print $buffer;
}
pclose($fp);
?>

...

[TOP]Explicitly delete Mail off server via PHP

...
<?php
$id = "noneofyourbiz";
$pass = "sameastheabove";
$msgnum = "1,2,10"; //etc multiple messages to be marked for deletion
$fp = popen('emia del /svr:mail.host.com /port:110 /id:'.$id.' /pass:'.$pass.' /msg:'.$msgnum.' 2>&1', 'r');
pclose($fp);
?>

...

[TOP]Retrieving Mail via Python

...
import os

output= os.popen('emia get /svr:mail.host.com /port:110 /id:noneofyourbiz /pass:likeiwould /a:message /msg:1 /DEL:0','r')
message = output.read()
output.close()

print message


...

[TOP]Deletion of Mail while retrieving it off server via Python

...
import os

output= os.popen('emia get /svr:mail.host.com /port:110 /id:noneofyourbiz /pass:likeiwould /a:message /msg:1 /DEL:1','r')
message = output.read()
output.close()

print message


...

[TOP]Explicitly checking STAT via Python

...
import os

output = os.popen('emia get /svr:mail.host.com /port:110 /id:noneofyourbiz /pass:likeiwould /a:stat','r')
stat = output.read()
output.close()

print stat

...

[TOP]Explicitly delete Mail off server via Python

...
import os

output = os.popen('emia del /svr:mail.host.com /port:110 /id:noneofyourbiz /pass:likeiwould /msg:1','r')
output.close()

...

 

 

© 2002/2003 Jeremy Aiyadurai . All Rights Reserved