Mailtraq - the Complete Email Server
   

Enstar for Mailtraq email server sales & support
Making world-class Internet technology affordable  

Search for:

Advanced search

GetFieldOfDirectory()

Returns the value of a field in the directory record for a specified Mailtraq message file. The field must be one of those described below, some of which are applicable to certain file types only. Also, some are only available to files contained within the Mailtraq database.

value := GetFieldOfDirectory( path , filename , field )

path
The relative or absolute location of the mailslot file
filename
The mailslot filename
field
A defined field in the mailslot file. See table below.
Field Type Applicable Directories Description
size Integer Any Directory The file size in bytes
date DateTime Any Directory The file creation date
subject String Any Indexed Directory The subject line from the message
to String Any Indexed Directory The addressee of the message
from String Any Indexed Directory The sender of the message
serial String Any Indexed Directory The unique serial number of the file
pop3_erased Boolean POP3 Collection Flag indicating if the message was erased
pop3_delete Boolean POP3 Collection Flag indicating if the message is marked for deletion
pop3_fetched Boolean POP3 Collection Flag indicating if the message was downloaded
pop3_download Boolean POP3 Collection Flag indicating if the message is marked for download

The following example uses the GetFieldOfDirectory() function to determine the arrival time of each of the messages in every mailbox.

That information is compared to the time of the last message collection for each mailbox and a report compiled and mailed.

a := CreateFile("mbox-info.txt");
Define("TextOut", 
  Write(a, LJ($1, 35) ++ LJ($2, 20) ++ LJ($3, 10) ++ LJ($4, 10))
);
TextOut("Mailbox","Last Collected","Total","Unread");
TextOut("-------","--------------","-----","------");
mbox_list := GetMailboxes();
For(mbox_list, "m_box",
  If(GetMailboxProp(m_box, "Type") = "MAILBOX",
    Do(
      path := "mail\inbox\" ++ m_box ++ "\",
      collect_time := GetSystemVar("/mailslots/" ++ m_box ++ "/LastCollection"),
      new_msg := 0,
      file_list := GetDirectory("mail\inbox\" ++ m_box ++ "\"),
      For(file_list, "file",
        If(GetFieldOfDirectory (path, file, "Date") > collect_time,
          new_msg := new_msg + 1
        )
      ),
      TextOut(m_box, 
        If(collect_time = 0, "Never Accessed",
          FormatDateTime("dd/mm/yy hh:nn", collect_time)
        ),
        ListCount(file_list), new_msg
      )
    ) 
  )
);
CloseFile(a);
PostMessage(MailServerAccount, AddressOf("postmaster"),
  Do(
    Setheader("Subject", "Mailbox Activity Report"),
    MsgAddLine("\nReport Date: " ++ FormatDateTime("dd/mm/yy 'at' hh:nn") ++ "\n"),
    a := OpenFile("mbox-info.txt"),
    While(Not(EOF(a)),
      MsgAddLine(Read(a))
    ),
    CloseFile(a)
  )
) 
Mailtraq Highlights...
 SMTP Server     Mailtraq SMTP email server video IMAP Server     Mailtraq IMAP email Server video
 POP3 Server     Mailtraq POP3 email server video Proxy Server     Mailtraq proxy email server video
 Webmail Server     Mailtraq webmail email server video Mailing-list Server     Mailing list email server video
 Groupware Services     Mailtraq groupware email services video Spam and Virus control     Spam and virus control email server video

 

   Copyright © 2003 - 2011 Enstar Ltd, Enstar LLC & Fastraq Ltd. All rights reserved. Privacy policy.
   Mailtraq® is a registered trademark of Fastraq Limited.