--------
OVERVIEW
--------

This file documents the functions in MDaemon's API library.  This library is
currently implemented in MDUSER.DLL, MDUSERLDAP.DLL, and MDUSERODBC.DLL.


-----------------
TABLE OF CONTENTS
-----------------

Revision history

Integrating your custom applications with MDaemon
LoadMDUserDll()
FreeMDUserDll()
LoadMDListDll()
FreeMDListDll()

Application level functions Database functions Messaging functions Domain management functions Account grouping functions Account management functions IMAP folder and rule management functions Mailing list management functions Gateway related functions Alias related functions Account template related functions API Reference ---------------- REVISION HISTORY ---------------- v15.6.0 ----- The following functions have been changed/added. ---------------------------------------------- MD_SetCanModifyGAB This function has been deprecated. Calling this function does nothing. It is left in place for backwards compatibility. v13.5.0 ----- The following functions have been changed/added. ---------------------------------------------- Added the following functions: MD_GetProcessCalendarRequests MD_SetProcessCalendarRequests Many changes have been made to the account grouping API: The following functions have changed: MD_SetGroups renamed MD_GroupSetUserGroups and the parameters passed to this function have changed (see details below). MD_GetGroups renamed MD_GroupGetUserGroups and the function now returns a comma delimited rather than a space delimited list of group names (see details below). MD_GetMembersOfGroup renamed MD_GroupGetMembers MD_AddGroupMember renamed MD_GroupAddMember MD_RemoveGroupMember renamed MD_GroupRemoveMember MD_RenameGroupMember renamed MD_GroupRenameMember MD_CreateGroup renamed MD_GroupCreate and the parameters passed to this function have changed (see details below). MD_RenameGroup renamed MD_GroupRename MD_DeleteGroup renamed MD_GroupDelete MD_GetAllGroups renamed MD_GroupGetAll and the function now returns a comma delimited rather than a space delimited list of group names (see details below). MD_GetAllGroupsWithDesc renamed MD_GroupGetAllWithDesc MD_FreeGroup renamed MD_GroupFree MD_ClearGroupCache renamed MD_GroupClearCache MD_FindGroupMember renamed MD_GroupFindMember Added the following functions and structure related to grouping: MD_Group - Group information structure MD_GroupInit - initializes an MD_Group structure MD_GroupGetCount - returns the number of groups MD_GroupUpdate - updates an existing group MD_GroupWrite - writes a group to disk MD_GroupGetADGroup - gets the group that matches to the provided active directory group name Added the following functions related to account templates: MD_TemplateExists - tests to see if a template already exists MD_TemplateGetAll - get list of all templates MD_TemplateFree - free memory allocated by template functions MD_TemplateCreate - create a template MD_TemplateRename - rename a template MD_TemplateDelete - delete a template MD_TemplateWrite - save/update a template to disk The following structures were changed. ----------------------------------- MD_UserInfo
The following members were added to the end of the structure: char TemplateName[MAX_TEMPLATE_NAME_LEN+1]; int TemplateFlags; bool DeclineConflictingRequests; bool DeclineRecurringRequests; bool RestrictPOPAccess; bool RestrictIMAPAccess; bool RestrictWCAccess; bool RestrictWAAccess; bool UseDefaultPruning; bool AttachmentLinking; bool ExtractOutbound; bool ExtractInbound; bool EnableSubaddressing; bool IsDomainAdmin; bool IsFrozen; bool MustChangePassword; bool DontExpirePassword; bool ApplyDomainSignature; bool ExemptFromAuthMatch; bool EnableComAgent; bool EnableInstantMessaging; int MaxSentPerDay; v9.6.0 ----- The following functions have been changed/added. ---------------------------------------------- MD_GetProcessCalendarRequests MD_SetProcessCalendarRequests MD_GetMultiPOPMaxMessageAge MD_SetMultiPOPMaxMessageAge The following structures were changed. ----------------------------------- MD_Domain
(1) a 'char FQDN[DOMAIN_LEN+1]' member has been added MD_Gateway
(1) a 'int LDAPSearchScope' member has been added (2) a MDGW_MINGER flag has been added (3) LDAPObjectClass member has been removed (4) LDAPMailAttribute member has been removed (5) MDGW_WILDCARDSEARCH flag has been removed (6) the following new constants have been defined MDGW_LDAP_SCOPE_BASE MDGW_LDAP_SCOPE_ONELEVEL MDGW_LDAP_SCOPE_SUBTREE MD_Rule
(1) a 'char Email[EMAIL_LEN+1]' member has been added The following functions have been renamed ---------------------------------------- MD_GetMaxMessageSize -> MD_GetMultiPOPMaxMessageSize MD_SetMaxMessageSize -> MD_SetMultiPOPMaxMessageSize The following functions and constants have been removed ---------------------------------------------------------- MDUSERDLL_EDITEMAILCHANGES MD_ListUseHtmlDigests MD_GetMaxUIDLCount MD_GetEditEmailChanges MD_SetEditEmailChanges Back to Table of Contents ------------------------------------------------- Integrating your custom applications with MDaemon ------------------------------------------------- For the convenience of our customers with advanced programming capabilities MDaemon includes MDUSER.DLL which contains several functions you can use to better integrate your custom software applications with MDaemon. These functions are written in C++ and have been tested using Microsoft Visual Studio 6.0 and Borland C++ 5.02. The \DOCS\API\ directory off your root MDaemon directory contains the following files: MDUSERIMPORTS.H - C/C++ header file containing definitions and structures used by the functions documented here. MDUSERIMPORTS.CPP - C/C++ source code file you can include in your project to integrate the API into your application. MDUSERIMPORTS.CPP contains a function called LoadMDUserDll. This function is used to initialize and load MDUSER.DLL. You must call this function before using any of the API functions documented here. Similarly, MDUSERIMPORTS.CPP
decline Recurring requests

contains a function called FreeMDUserDll which must be called prior to your
application being terminated.


bool LoadMDUserDll( int& Result // buffer to store error result code char* Path // path to MDUSER.DLL file bool LoadUsers // TRUE if account information should be loaded bool IgnoreFail // TRUE if errors loading DLL should be ignored bool PopupErrors // TRUE if errors loading DLL be displayed in a popup message box ) This function initializes MDUSER.DLL for use with your application and maps all the API functions into your application's address space. Parameters Result - if an error occurs this variable will have the result code returned from the Win32 API function GetLastError. Path - optional path to the MDUSER.DLL file. LoadUsers - TRUE if account information should be loaded into memory once the DLL has been successfully initialized. IgnoreFail - Normally when a pointer to each known function within the DLL cannot be obtained the DLL will be unloaded and this function will return FALSE. Setting this function to TRUE prevents the unloading of the DLL in such cases (although this function will still return FALSE). This allows you to use the most recent version of MDUSERIMPORTS.CPP/MDUSERIMPORTS.H even with older versions of the DLL. PopupErrors - If TRUE, displays error message in a popup message box. Return values This function returns TRUE if MDUSER.DLL was successfully loaded and all the API functions were mapped into your application's address space without error. Otherwise it returns FALSE. Remarks This function is located within MDUSERIMPORTS.CPP. To use this function your application must include MDUSERIMPORTS.CPP as part of the project or work- space. If this function returns FALSE Result will contain the Win32 API numerical error code which can be used to determine the reason for the failure. Path can be NULL in which case MDUSER.DLL is assumed to be in the same directory as your application. Example // it is assumed that MDUSERIMPORTS.CPP is a part of the example workspace int Result; if (!LoadMDUserDll(Result, NULL, false)) // handle error else // proceed Back to Table of Contents
void FreeMDUserDll() This function frees MDUSER.DLL. Parameters none Return values none Remarks This function is located within MDUSERIMPORTS.CPP. To use this function your application must include MDUSERIMPORTS.CPP as part of the project or work- space. Your application should call this function before it terminates. Back to Table of Contents
bool LoadMDListDll( int& Result // buffer to store error result code char* Path // path to MDLIST.DLL file bool IgnoreFail // TRUE if errors loading DLL should be ignored bool PopupErrors // TRUE if errors loading DLL be displayed in a popup message box ) This function initializes MDLIST.DLL for use with your application and maps all the mailing list API functions into your application's address space. Parameters Result - if an error occurs this variable will have the result code returned from the Win32 API function GetLastError. Path - optional path to the MDLIST.DLL file. IgnoreFail - Normally when a pointer to each known function within the DLL cannot be obtained the DLL will be unloaded and this function will return FALSE. Setting this function to TRUE prevents the unloading of the DLL in such cases (although this function will still return FALSE). This allows you to use the most recent version of MDUSERIMPORTS.CPP/MDUSERIMPORTS.H even with older versions of the DLL. PopupErrors - If TRUE, displays error message in a popup message box. Return values This function returns TRUE if MDLIST.DLL was successfully loaded and all the API functions were mapped into your application's address space without error. Otherwise it returns FALSE. Remarks This function is located within MDUSERIMPORTS.CPP. To use this function your application must include MDUSERIMPORTS.CPP as part of the project or work- space. If this function returns FALSE Result will contain the Win32 API numerical error code which can be used to determine the reason for the failure. Path can be NULL in which case MDLIST.DLL is assumed to be in the same directory as your application. Example // it is assumed that MDUSERIMPORTS.CPP is a part of the example workspace int Result; if (!LoadMDListDll(Result, NULL, false, false)) // handle error else // proceed Back to Table of Contents
void FreeMDListDll() This function frees MDLIST.DLL. Parameters none Return values none Remarks This function is located within MDUSERIMPORTS.CPP. To use this function your application must include MDUSERIMPORTS.CPP as part of the project or work- space. Your application should call this function before it terminates. Back to Table of Contents
------------- API Reference ------------- The API contains functions which are divided into the following groups: APPLICATION LEVEL FUNCTIONS MD_RegisterWindow MD_UnregisterWindow MD_GetSharedUserInfo MD_ReloadUsers MD_CreateFileName DATABASE FUNCTIONS MD_GetAppDir MD_GetDBPath MESSAGE HANDLING FUNCTIONS MD_MessageInfo structure MD_InitMessageInfo MD_VerifyMessageInfo MD_SpoolMessage DOMAIN RELATED FUNCTIONS MD_GetDomainNames MD_GetDomainCount MD_GetDomainNameUsingIP MD_GetDomainsGab MD_InitDomainInfo MD_VerifyDomainInfo MD_UpdatesuppressionList MD_RenameDomain MD_WriteDomain MD_DeleteDomain GROUP RELATED FUNCTIONS MD_Group structure MD_GroupInit MD_GroupGetCount MD_GroupUpdate MD_GroupWrite MD_GroupSetUserGroups MD_GroupGetUserGroups MD_GroupExists MD_GroupGetMembers MD_GroupAddMember MD_GroupRemoveMember MD_GroupRenameMember MD_GroupCreate MD_GroupRename MD_GroupDelete MD_GroupGetAll MD_GroupGetAllWithDesc MD_GroupFree MD_GroupClearCache MD_GroupFindMember MD_GroupGetADGroup ACCOUNT MANAGEMENT FUNCTIONS MD_UserInfo structure MD_InitUserInfo MD_GetUserInfo MD_SetUserInfo MD_VerifyUserInfo MD_AddUser MD_ChangeUser MD_DeleteUser MD_FindFirst MD_FindNext MD_FindClose MD_GetByEmail MD_GetByFullName MD_GetByMailbox MD_GetByMailDir MD_GetByAlias MD_GetFree MD_UserExists MD_UserCount MD_ValidateUser MD_LogonUser MD_FilterString MD_FilterUserInfo MD_GetEmail MD_GetMailbox MD_SetMailbox MD_GetDomain MD_SetDomain MD_GetFullName MD_SetFullName MD_GetMailDir MD_SetMailDir MD_GetPassword MD_SetPassword MD_GetAutoDecode MD_SetAutoDecode MD_GetIsForwarding MD_SetIsForwarding MD_GetAllowPOPAccess MD_GetAllowIMAPAccess MD_GetAllowAccess MD_SetAllowAccess MD_SetAccessType MD_GetAllowChangeViaEmail MD_SetAllowChangeViaEmail MD_GetKeepForwardedMail MD_SetKeepForwardedMail MD_GetHideFromEveryone MD_SetHideFromEveryone MD_GetProcessCalendarRequests MD_SetProcessCalendarRequests MD_GetApplyQuotas MD_SetApplyQuotas MD_GetEnableMultiPOP MD_SetEnableMultiPOP MD_GetCanModifyGAB MD_SetCanModifyGAB MD_GetMailRestrictions MD_SetMailRestrictions MD_GetMaxDiskSpace MD_SetMaxDiskSpace MD_GetMaxMessageCount MD_SetMaxMessageCount MD_GetForwardingInfo MD_SetForwardingInfo MD_GetAutoRespInfo MD_SetAutoRespInfo MD_EraseAutoResp MD_GetMailFormat MD_SetMailFormat MD_GetFileCount MD_GetQuotaCounts MD_UpdateQuotaCounts MD_GetDirSize MD_GetWebConfigBit MD_SetWebConfigBit MD_GetAccessWorldClient MD_SetAccessWorldClient MD_GetAccessWebConfig MD_SetAccessWebConfig MD_GetIsAdmin MD_SetIsAdmin MD_GetEditFullName MD_SetEditFullName MD_GetEditPassword MD_SetEditPassword MD_GetEditMailDir MD_SetEditMailDir MD_GetEditFwd MD_SetEditFwd MD_GetEditAdvFwd MD_SetEditAdvFwd MD_GetEditEveryone MD_SetEditEveryone MD_GetEditMailRestrictions MD_SetEditMailRestrictions MD_GetEditQuotas MD_SetEditQuotas MD_GetEditMultiPOP MD_SetEditMultiPOP MD_GetEditAutoResponder MD_SetEditAutoResponder MD_GetEditIMAPRules MD_SetEditIMAPRules MD_IsDynamicPasswordStr MD_GetMultiPOPMaxMessageAge MD_SetMultiPOPMaxMessageAge MD_GetMultiPOPMaxMessageSize MD_SetMultiPOPMaxMessageSize MD_RestrictInboundMail MD_SetInboundMailRestrictions MD_RestrictOutboundMail MD_SetOutboundMailRestrictions MD_GetPruningFlags MD_SetPruningFlags MD_GetUseDefaultPruning MD_SetUseDefaultPruning MD_GetAddrBookParms MD_SetAddrBookParms IMAP FOLDER AND RULE MANAGEMENT FUNCTIONS MD_FindFirstRule MD_FindNextRule MD_GetEditIMAPRules MD_SetEditIMAPRules MD_ReadRule MD_RuleStructToRuleString MD_RuleStringToRuleStruct MD_DeleteRule MD_AddRule MD_ChangeRule MD_GetIMAPFolders MD_CreateIMAPFolder MD_GetPublicIMAPFolderAccess MD_PublicIMAPFolderACLRemove MD_PublicIMAPFolderACLUpdate MAILING LIST MANAGEMENT FUNCTIONS (**Don't forget to LoadMDListDll() before accessing these functions and to FreeMDListDll() before terminating the application.**) MD_List structure MD_ListSyncWithPublicFolder MD_InitListInfo MD_VerifyListInfo MD_WriteList MD_DeleteList MD_ClearListSettingsCache MD_ListPrivate MD_ListAllowExpn MD_ListCrackMessage MD_ListRouteMessage MD_ListUseMemberNames MD_ListUseListName MD_ListInsertCaption MD_ListForceUniqueID MD_ListPasswordPost MD_ListIgnoreRcptErrors MD_ListNameInSubject MD_ListThreadNumbInSubject MD_ListAuthSubscribe MD_ListAuthAutoSubscribe MD_ListAuthUnsubscribe MD_ListAuthUnsubscribe MD_ListEnableDigest MD_ListForceDigestUse MD_ListAM MD_ListPM MD_ListArchiveDigest MD_ListInformNonMember MD_ListSendStatusMessages MD_ListAutoPrune MD_ListUsePublicFolder MD_ListAllowUnsubscribe MD_ListMaxMessageSize MD_ListMaxMembers MD_ListRoutingLimit MD_ListMaxMessageCount MD_ListMaxLineCount MD_ListApplyHeader MD_ListApplyFooter MD_ListKillFile MD_ListRemoteHost MD_ListWelcomeFile MD_ListReplyAddress MD_ListPublicFolderName MD_ListDefaultMode MD_ListAddMember MD_ListWriteMember MD_ListSetRealName MD_ListSetDigest MD_ListSetNomail MD_ListSuppress MD_ListIsMember MD_ListRemoveMember MD_LIstRemoveFromAll MD_ListNotificationAddress MD_ListPrecedenceLevel MD_ListMemberCount MD_ListSubscribeNote MD_ListUnsubscribeNote MD_ListMsgTooBigNote MD_ListPassword MD_ListArchiveCatalog MD_ListDigestMBF MD_ListModerated MD_ListAllowSubscribe MD_ListSendSubAuth MD_ListSendUnSubAuth GATEWAY MANAGEMENT FUNCTIONS MD_GetGatewayCount MD_GetGatewayNames MD_InitGatewayInfo MD_VerifyGatewayInfo MD_WriteGateway MD_DeleteGateway ALIAS MANAGEMENT FUNCTIONS MD_DeleteAllAliases MD_DeleteAlias MD_CreateAlias --------------------------- APPLICATION LEVEL FUNCTIONS --------------------------- The following functions allow you to load the API and register and unregister your application's main window handle with MDUSER.DLL. Various actions performed by applications using the DLL generate notifications which are sent to all registered applications. For example, if you wish your application to be notified that someone has removed an account via the MDaemon GUI you need to register your window handle with the DLL. MDUSER.DLL uses SendMessage to inform each registered application that an important event has taken place. Because each application is notified via a call to SendMessage rather than PostMessage your application's event handler must process these messages as quickly as possible. Lengthy processing should not be performed in your applications event loop. Rather, set a flag and perform the lengthy processing later - after your application has returned control back to MDUSER.DLL. MDUSER.DLL will send the WM_MDUSERDLL_MSG message to all registered windows whenever an important event occurs. The WPARAM value will be determined by the type of event that has taken place: WM_MDUSERDLL_LOADING - Some accounts have just been loaded from USERLIST.DAT. The number of accounts loaded will be passed in LPARAM. WM_MDUSERDLL_ADDSEM - New account added via semaphore file WM_MDUSERDLL_CHANGESEM - Account modified via semaphore file WM_MDUSERDLL_DELETESEM - Account deleted via semaphore file WM_MDUSERDLL_ADD - New account added via MD_AddUser() function WM_MDUSERDLL_CHANGE - Account modified via MD_ChangeUser() function WM_MDUSERDLL_DELETE - Account deleted via MD_DeleteUser() function
bool MD_RegisterWindow( HWND Handle // window handle to send notifications to ) This function is used to register a window handle with MDUSER.DLL. Parameters Handle - this is the window handle that MDUSER.DLL will send notification messages to. Return values This function returns TRUE if the handle was registered. Otherwise it returns FALSE which means that MDUSERDLL_MAXHANDLES applications have already been registered. Remarks This function should be called to register the window handle within your application which should receive notifications of various events which occur such as adding accounts, deleting accounts, or reloading accounts. MDUSER.DLL will call SendMessage to inform Handle of these events. See the discussion at the start of this section for details. Example HWND Handle = GetMainWindow(); if (MD_RegisterWindow(Handle)) // ok to proceed else // handle error Back to API reference
bool MD_UnregisterWindow( HWND Handle // window handle to stop notifications to ) This function is used to unregister a window handle with MDUSER.DLL. Parameters Handle - this is the window handle to unregister. Return values This function returns TRUE if the handle was unregistered. Otherwise it returns FALSE which means that Handle was not previously registered. Example HWND Handle = GetMainWindow(); if (MD_UnregisterWindow(Handle)) // ok to proceed else // handle error Back to API reference
MD_UserInfo* MD_GetSharedUserInfo() This function is used to aquire information on an account that has just been added, deleted, or changed. Parameters none Return values This function returns a pointer to an MD_UserInfo structure that is owned by the DLL. Remarks The structure returned by this function must never be altered in any way or freed. This structure is shared by all applications using the DLL and is freed automatically when the DLL is unloaded from memory by the operating system. This function can be used by your application during processing of a WM_MDUSERDLL_ADDSEM, WM_MDUSERDLL_CHANGESEM, WM_MDUSERDLL_DELETESEM, WM_MDUSERDLL_ADD, WM_MDUSERDLL_CHANGE, or WM_MDUSERDLL_DELETE message. The structure returned will contain complete details on the account which was added, deleted, or changed. When using this function along with a WM_MDUSERDLL_CHANGESEM or WM_MDUSERDLL_CHANGE event the returned structure will contain the values the account had BEFORE the changes were applied. The UserDefined member of the structure will contain the new email address for the account. This email address can then be used in a followup call to MD_GetUserInfo() to retrieve the new account details. The values within the returned structure are only good until the next event occurs. Therefore, do not perform operations with this structure directly. Rather, copy it to your own MD_UserInfo structure and use that. Example MD_UserInfo MyUserInfo; switch (WPARAM) { case WM_MDUSERDLL_ADD: case WM_MDUSERDLL_ADDSEM: { memcpy(&MyUserInfo, MD_GetUserInfo(), sizeof(MD_UserInfo)); char WorkBuffer[256]; sprintf(WorkBuffer, "Account added for: %s", MyUserInfo.FullName); break; } } Back to API reference
void MD_ReloadUsers() This function causes the DLL to completely reload it's internal storage of account information. Parameters none Return values none Remarks This function is used internally. You can call it yourself if you need to force the DLL to completely reload all account information. Example MD_ReloadUsers(); Back to API reference
char* MD_CreateFileName( char* szFileName // Buffer to contain the created message filename char* szRootPath // Rootpath for the filename to create const int iImportance // Importance of the message char* szPrefix // Prefix for created filename char* szExtension // Extension for created filename ) This function creates a unique message name based on information in the hiwater.mrk if available. Parameters szFileName - This is where the created filename will be stored szRootPath - This is the directory to use for creating the unique filename iImportance - This is the importance of the message szPrefix - The prefix you want for the filename szExtension - The extension you want the filename to have Return values This function returns the created filename Back to API reference ------------------ DATABASE FUNCTIONS ------------------ These functions deal with MDaemon's various DAT files.
char* MD_GetAppDir( char* Buffer // buffer to receive path int BufLen // maximum length of Buf ) This function retrieves the path to the MDaemon APP directory and places it in Buffer. Parameters Buffer - character pointer that will receive the path to MDaemon's APP directory BufLen - maximum length of Buffer Return values The function returns Buffer which will contain a complete path to the MDaemon APP directory. Remarks Buffer should be at least MAX_PATH+1 chars long. Example char AppPath[MAX_PATH+1]; MD_GetAppDir(AppPath, MAX_PATH); Back to API reference
void MD_GetDBPath( char* Buffer // buffer to receive path int Flag // integer specifying which database to get ) This function retrieves the complete path to any one of MDaemon's several configuration files. Parameters Buffer - character pointer that will receive the path to the specified configuration file. Buffer must be at least MAX_PATH+1 chars long. Flag - integer constant which determines which configuration file is returned. Valid values are: MDUSERDLL_MDAEMONINIDB - returns path to MDaemon.ini file MDUSERDLL_USERLISTDB - returns path to account database MDUSERDLL_DOMAINPOPDB - returns path to DomainPOP settings database MDUSERDLL_DOMAINDB - returns path to the domain database MDUSERDLL_HELPDB - returns path to the default help file MDUSERDLL_RECEIPTDB - returns path to the receipt confirmation file MDUSERDLL_NOCOMMANDDB - returns path to the 'no valid command' file MDUSERDLL_NOSUCHUSERDB - returns path to the 'no such user' file MDUSERDLL_UIDLDB - returns path to UIDL database MDUSERDLL_MIMETYPEDB - returns path to MIMETYPE database MDUSERDLL_ALIASDB - returns path to address alias database MDUSERDLL_TRANSLATEDB - returns path to the header translation database MDUSERDLL_TRANSEXCPTDB - returns path to translation exception database MDUSERDLL_RFC822TMPDB - returns path to rfc822 MBF file MDUSERDLL_IPSHIELDDB - returns path to IP shielding database MDUSERDLL_FWDDB - returns path to account forwarding database MDUSERDLL_MAILFORMATDB - always returns path to mail format database MDUSERDLL_AUTORESPDB - returns path to auto responder database MDUSERDLL_GATEWAYDB - returns path to gateway domains database MDUSERDLL_REFUSALDB - returns path to message refusal file MDUSERDLL_LOCALONLYDB - returns path to local only message file MDUSERDLL_MULTIPOPDB - returns path to account MultiPOP database MDUSERDLL_IPCACHEDB - returns path to IP cache database MDUSERDLL_MXCACHEDB - returns path to MX cache database MDUSERDLL_NOCACHEDB - returns path to no cache database MDUSERDLL_PRIORITYDB - returns path to priority mail database MDUSERDLL_EXCEPTIONDB - returns path to priority mail exceptions database MDUSERDLL_DELUNLESSDB - returns path to 'delete unless' database MDUSERDLL_FWDUNLESSDB - returns path to 'forward unless' database MDUSERDLL_DVUNLESSDB - returns path to 'deliver unless' database MDUSERDLL_MSGIDDB - returns path to Message-ID database MDUSERDLL_IPSCREENDB - returns path to IP screening database MDUSERDLL_RELAYDB - returns path to mail relaying database MDUSERDLL_AUTHDB - returns path to outstanding sub/unsub auth database MDUSERDLL_SPAMBLOCKERDB - returns path to spam blocker database MDUSERDLL_SPAMEXCEPTDB - returns path to spam blocker exception database MDUSERDLL_SPAMCACHEDB - returns path to spam blocker cache database MDUSERDLL_LDAPDB - returns path to LDAP configuration file Return values none Remarks Use this function when you want to get the complete path to one of MDaemon's configuration files. Example char MDaemonIniFile[MAX_PATH+1]; MD_GetDBPath(MDaemonIniFile, MDUSERDLL_MDAEMONINIDB); if (MDaemonIniFile[0] != '\0') // do something with file Back to API reference -------------------------- MESSAGE HANDLING FUNCTIONS -------------------------- What follows is a description of the message sending support built into the MDUSER.DLL file. These functions work by taking information from your program and using it to generate a RAW format message which MDaemon in turn processes and delivers. For complete details on the RAW message sub-system please consult the MDaemon manual. The following functions make use of the MD_MessageInfo structure to send an email message. Sending a message involves declaring one of these structure variables, initializing it, filling in the structure members, and calling the function which actually spools the message. Since the entire process depends on the MD_MessageInfo structure we will describe that first and then proceed to document the functions which use the structure. #define MDUSERDLL_MAXMSGTO_LEN 128 #define MDUSERDLL_MAXMSGFROM_LEN 128 #define MDUSERDLL_MAXMSGSUBJECT_LEN 128 #define MDUSERDLL_MAXCONTENTTYPE_LEN 128 #define MDUSERDLL_MAXCHARSET_LEN 30 #define MDUSERDLL_MAXMSGBODY_LEN 5001 struct MD_MessageInfo { char To[MDUSERDLL_MAXMSGTO_LEN+1]; char From[MDUSERDLL_MAXMSGFROM_LEN+1]; char Subject[MDUSERDLL_MAXMSGSUBJECT_LEN+1]; char ContentType[MDUSERDLL_MAXCONTENTTYPE_LEN+1]; char CharSet[MDUSERDLL_MAXCHARSET_LEN+1]; char MessageBody[MDUSERDLL_MAXMSGBODY_LEN+1]; char BodyFilePath[MAX_PATH+1]; char AttachmentFilePath[MAX_PATH+1]; bool RemoveAttachment; int Priority; }; Fields To - this field contains the name of the recipient of the email message. It can contain any value which MDaemon allows within the TO header of a RAW format message (see MDaemon manual for details) From - this field contains the name of the sender of the email message. It can contain any value which MDaemon allows within the FROM header of a RAW format message (see MDaemon manual for details) Subject - this field contains the subject of the email message. ContentType - this field allows you to set the content type for the new message. CharSet - this field allows you to set the charset that the new message will use. MessageBody - this field contains the text of the message body. BodyFilePath - this field contains the path to a text file that should be used as the message body. After calling MD_SpoolMessage you should remove this file. AttachmentFilePath - this field contains the path to a single file on disk which should be encoded and attached to the message. RemoveAttachment - if TRUE the file specified in AttachmentFilePath will be removed from disk once the message has been converted for sending by MDaemon. Priority - this field specifies the relative importance of this message. Remarks The MessageBody field has a maximum length of MDUSERDLL_MAXMSGBODY_LEN chars. If this is not enough space the text should be placed in a separate disk file and the BodyFilePath field should be used. Note that both can be used in the same structure. So, you can specify up to MDUSERDLL_MAXMSGBODY_LEN chars in the MessageBody field and place the rest in a text file for use with the BodyFilePath field. If you leave the ContentType field blank a default value of 'text/plain' will be used. To create a message in HTML format strcpy a value of 'text/html' into this field. If you leave the CharSet field blank a default value of 'US-ASCII' will be used. Most HTML messages tend to use a charset of 'iso-8859-1'. An potential problem occurs if you specify the ContentType or CharSet values and also attach a file to the message using AttachmentFilePath. In such cases MD is forced to override the ContentType and CharSet values you provide with 'multipart/mixed' in order to deal with the attachment. Only a single file can be specified in the AttachmentFilePath field. The RemoveAttachment field does not cause the attached file to be removed immediately. The file is removed by MDaemon once the RAW message is converted and fully prepared for delivery. This is done by MDaemon when the RAW queue is processed. The Priority field can contain any one of the following values: MD_PRECEDENCE_URGENT // an extremely important message MD_PRECEDENCE_HIGH // a message that is more important than normal MD_PRECEDENCE_NORMAL // this is the default for normal mail MD_PRECEDENCE_LOW // some system or robot generated mail MD_PRECEDENCE_BULK // default mailing list mail MD_PRECEDENCE_RETRY // messages in the retry queue Back to API reference
void MD_InitMessageInfo( MD_MessageInfo* MessageInfo // pointer to MD_MessageInfo struct ) The MD_InitMessageInfo structure initializes an MD_MessageInfo structure in preparation for sending an email message using MD_SpoolMessage. Parameters MessageInfo - pointer to an MD_MessageInfo structure. This members of this structure are cleared and the priority member is set to MD_PRECEDENCE_NORMAL. Remarks You should call this function immediately after declaring an MD_MessageInfo structure. Example MD_MessageInfo MessageInfo; MD_InitMessageInfo(&MessageInfo); Back to API reference
int MD_VerifyMessageInfo( MD_MessageInfo* MessageInfo // pointer to MD_MessageInfo struct ) The MD_VerifyMessageInfo structure verifies the content of the MessageInfo structure that is passed. This will insure that your message is valid for sending. Parameters MessageInfo - pointer to an MD_MessageInfo structure. The members of this structure are verified. Return values MDDLLERR_NOERROR - returned if the structure is valid. MDDLLERR_MISSINGTO - returned if the structure is missing the TO field. MDDLLERR_MISSINGFROM - returned if the structure is missing the FROM field. MDDLLERR_MISSINGBODY - returned if the structure is missing a message body and the BodyFilePath member of the passed structure is not provided. MDDLLERR_MISSINGBODYFILE - returned if the structure contains a file in the BodyFilePath member which doesn't exist. MDDLLERR_MISSINGATTACHMENTFILE - returned if the structure contains a file in the AttachmentFilePath member which doesn't exist. Remarks This function should be called when the MessgeInfo structure needs to be verified. This function is called from MD_SpoolMessage automatically. Example MD_MessageInfo* MessageInfo; MD_InitMessageInfo(&MessageInfo); // copy information into the MessageInfo members if (MD_VerifyMessageInfo(&MessageInfo) == MDDLLERR_NOERROR) // spool message else // handle error Back to API reference
int MD_SpoolMessage( MD_MessageInfo* MessageInfo // pointer to MD_MessageInfo structure ) The MD_SpoolMessage function creates the message and places it into MDaemon's mail queue. Parameters MessageInfo - pointer to an MD_MessageInfo structure. The data contained in this structure will be used to generate a mail message which MDaemon will queue and send. Return values (see MD_VerifyMessageInfo - any of those values could be returned) MDDLLERR_MISSINGRAWPATH - returned if the RAWFILES path could not be read from the MDaemon.ini file. MDDLLERR_CANTGENRAWFILENAME - returned if a new file name for the message could not be generated. MDDLLERR_CANTLOCKRAWFILE - returned if the new file name could not be locked. MDDLLERR_CANTCREATERAWFILE - returned if the new message file could not be created. MDDLLERR_CANTACCESSBODYFILE - returned if the MessageInfo specifies a body file which can't be accessed. Remarks The first thing this function does is call MD_VerifyMessageInfo passing the MessageInfo parameter to it. If an error results MD_SpoolMessage returns that error. MD_SpoolMessage attempts to generate a new RAW message file name, lock the file, create the RAW message, unlock the file, and return. If successful a new message in MDaemon's RAW message format will be placed into MDaemon's RAW message queue directory. MDaemon will then process and send the message at the next scheduled queue run. Example MD_MessageInfo MessageInfo; MD_InitMessageInfo(&MessageInfo); // copy information into the MessageInfo members if (MD_SpoolMessage(&MessageInfo) == MDDLLERR_NOERROR) // the message was successfully spooled else // handle error Back to API reference --------------------------- DOMAIN MANAGEMENT FUNCTIONS --------------------------- The following functions deal with domain management. struct MD_Domain { char DomainName[DOMAIN_LEN+1]; char FQDN[DOMAIN_LEN+1]; char IP[IPADDR_LEN+1]; int MaxInactive; int MaxMessageAge; int MaxDeletedIMAPMessageAge; int POP_Throttle; int IMAP_Throttle; int MultiPOP_Throttle; int DomainPOP_Throttle; int InboundSMTP_Throttle; int OutboundSMTP_Throttle; char* SuppressList; char* AdminList; int Flags; int MaxUsers; int MaxLists; }; Fields DomainName - the name of the domain FQDN - Fully qualified domain name as described in RFC 2821 (default is FQDN of primary domain) IP - the domain's IP address (a default of 127.0.0.1 is used) MaxInactive - account inactivity timeout (in days, 0 = no inactivity timeout) MaxMessageAge - max life of messages in this domain (in days, 0 = no time limit) MaxDeletedIMAPMessageAge - max life of IMAP deleted messages (in days, 0 = no time limit) POP_Throttle = max KB/s for POP sessions in this domain IMAP_Throttle = max KB/s for IMAP sessions in this domain MultiPOP_Throttle = max KB/s for MultiPOP sessions in this domain DomainPOP_Throttle = max KB/s for DomainPOP sessions in this domain InboundSMTP_Throttle = max KB/s for InboundSMTP sessions in this domain OutboundSMTP_Throttle = max KB/s for OutboundSMTP sessions in this domain SuppressList - double NULL terminated list of email addresses not allowed to send to this domain AdminList - comma delimited list of email addresses who are admins of this domain Flags - bit mask holding various domain flags MaxUsers - number of accounts that can be created in this domain by a domain administrator MaxLists - number of mailing lists that can be created in this domain by a domain administrator Remarks The Flags field is a bitmask which can contain one or more of the following bit flags: MDDM_BIND - domain has listening sockets bound to IP MDDM_RECURSEIMAP - delete old messages from IMAP folders for domain users MDDM_ANTIVIRUS - apply antivirus scanning to messages from/to this domain MDDM_ANTISPAM - apply antispam filters to messages from/to this domain Accounts which have been inactive for MaxInactive days will be deleted. Messages for users of the domain which are more than MAxMessageAge days old will be deleted. IMAP messages marked for deletion will be deleted after MaxDeletedIMAPMessageAge days. Back to API reference
int MD_GetDomainCount() This function returns the total number of domains currently being used. It includes the primary domain and all secondary domains. Return values This function returns the total number of domains currently being used. Back to API reference
void MD_GetDomainNames( char* Buffer // buffer to receive domain list int BufLen // length of buffer ) This function places all domain names into Buffer without exceeding BufLen. Parameters Buffer - this is the buffer which will receive the domain list BufLen - this is the maximum length of Buffer Remarks Buffer will contain a NULL separated list of all MDaemon domain names. The end of the string will be double NULL terminated. For example, the resulting string might look like this: "altn.com\0arvel.altn.com\0arvelh.com\0\0" If Buffer is not long enough to contain all the data then as many domain names as will fit will be placed into Buffer. To be sure that the size of Buffer is allocated with enough space you can do something like this: int Size = MD_GetDomainCount() * (DOMAIN_LEN+1); char* Buffer = new char[Size + 1]; MD_GetDomainNames(Buffer, Size); char* ptr = Buffer; while (*ptr != '\0') { sprintf(Str, "Domain Name: %s", ptr); ptr += strlen(ptr)+1; } The primary domain is always the first domain in the returned list. Back to API reference
char* MD_GetDomainNameUsingIP( const char* IP // IP to match to a domain name char* Buffer // buffer to store domain name int BufLen // maximum length of Buffer ) This function attempts to find a domain name which matches a given IP address and return the result in Buffer. Parameters IP - This is the IP address of the domain you wish to find Buffer - When a domain is found it is placed in this field BufLen - maximum size of Buffer Return values If IP contains an IP address the function returns the first domain that is found which is using that IP address. If IP is blank or no match is found then the primary domain is returned. Remarks One way to get the primary domain name is to call this function and specify an empty string as the IP address. This function does not guarantee that the IP address you pass is in use by one of MDaemon's domains. If a match cannot be made the primary domain is returned. Back to API reference
char* MD_GetDomainsGAB( const char* Domain // IP to match to a domain name char* GABPathName // buffer to store domain name ) This function gets the pathname of the Global Address Book for this domain taking into account domains configured to use a unique, shared or global address book. In the WorldClient\Domains.Ini file if a domain has the UniqueAddrBook setting enabled then the address book will be \MDaemon\WorldClient\domain.com.xml If the domain does not have the UniqueAddrBook setting enablde then this function will return the GABFileName domain setting. If the GABFileName domain setting is non existant then it will return the default GABFileName stored under Default:Settings in the domains.ini Parameters Domain - Domain name GABPathName - Buffer to hold the GAB pathname, must be at least MAX_LEN+1 Return values Returns the global address book pathname for the specified domain Back to API reference
void MD_InitDomainInfo( MD_Domain* Domain // Pointer to MD_Domain structure const char* Name // Name of domain ) This function initializes an MD_Domain structure Parameters Domain - Pointer to MD_Domain structure which will be initialized Name - the domain name of this domain (ex: my.domain.com) Return values None Remarks This function initializes Domain to various default settings. It must be called prior to using an MD_Domain structure. Name must be the domain name (ex: my.domain.com). If the domain does not exist it is created. If it does exist then the Domain member is initialized to the existing domains values. This function allocates a block of memory for the SuppressList and AdminList members which can only be freed by calling MD_FreeDomain(). Each call to MD_InitDomainInfo() must have a corresponding call to MD_FreeDomain(). Calling MD_InitDomainInfo() multiple times using the SAME MD_Domain structure will result in a memory leak. Example MD_Domain Domain; MD_InitDomainInfo(&Domain, "my.domain.com"); Back to API reference
int MD_VerifyDomainInfo( MD_Domain* Domain // Pointer to MD_Domain structure ) This function verifies the content of the passed MD_Domain structure. Parameters Domain - Pointer to MD_Domain structure Return values This value returns one of the following values: MDDMERR_NOERROR - no error found MDDMERR_NODOMAINNAME - the DomainName member of Domain was blank Remarks This function verifies that the passed MD_Domain structure is configured with acceptable settings. It must be called prior to calling MD_WriteDomain(). Example MD_Domain Domain; MD_InitDomainInfo(&Domain, "my.domain.com"); Domain->Flags |= MDDM_RECURSEIMAP; if (MD_VerifyDomainInfo(&Domain) == MDDMERR_NOERROR) MD_WriteDomain(&Domain); Back to API reference
bool MD_UpdateSuppressionList( MD_Domain* Domain // Pointer to MD_Domain structure const char* Email // Email address to add/remove to/from suppression list int Flag // Flag indicating whether Email should be added or removed ) This function adds or removes an email address to or from the suppression list for a domain. Parameters Domain - Pointer to MD_Domain structure Email - Email address to add/remove to/from suppression list Flag - Flag indicating whether Email should be added or removed Return values This function returns TRUE if Email was successfully added or deleted. Otherwise it returns FALSE. Remarks Flag can be one of the following: MDDM_ADD - Email is added to the suppress list for Domain (unless it is already present). MDDM_REMOVE - Email is removed from the suppress list for Domain (assuming it is present). If MDDM_ADD is used and Email is already present in the suppression list this function returns FALSE. Example MD_Domain Domain; MD_InitDomainInfo(&Domain, "my.domain.com"); MD_UpdateSuppressList(&Domain, "miked@guesswhere.com", MDDM_ADD); if (MD_VerifyDomainInfo(&Domain) == MDDMERR_NOERROR) MD_WriteDomain(&Domain); Back to API reference
bool MD_WriteDomain( MD_Domain* Domain // Pointer to MD_Domain structure ) This function write the domain to disk. Parameters Domain - Pointer to MD_Domain structure Return values This function returns TRUE if the domain settings were written to disk. Otherwise it returns FALSE. Example MD_Domain Domain; MD_InitDomainInfo(&Domain, "my.domain.com"); Domain->Flags |= MDDM_RECURSEIMAP; if (MD_VerifyDomainInfo(&Domain) == MDDMERR_NOERROR) MD_WriteDomain(&Domain); Back to API reference
bool MD_RenameDomain( const char* OldDomainName // The name of the domain to rename const char* NewDomainName // The name to rename the old domain too ) This function renames a domain. Parameters OldDomainName - name of existing domain to rename NewDomainName - name to rename the old domain too Return values This function returns TRUE if the domain was renamed. Otherwise it returns FALSE. Example bool Result = MD_RenameDomain("altn.com", "arvelh.com"); Back to API reference
void MD_DeleteDomain( const char* Name // Name of domain to delete ) This function deletes a domain. Parameters Name - name of the domain to delete Return values None Remarks The domain is completely deleted from disk. Use with care. All users of this domain and all their mail will be deleted from disk. Example MD_DeleteDomain("my.domain.com"); Back to API reference /**/ -------------------------- ACCOUNT GROUPING FUNCTIONS -------------------------- This group of functions allow management of MDaemon's account groups.
struct MD_Group { char GroupName[MAX_GROUP_NAME_LEN+1]; char Description[MAX_GROUP_DESC_LEN+1]; char TemplateName[MAX_TEMPLATE_NAME_LEN+1]; char ADGroupName[MAX_GROUP_AD_NAME_LEN+1]; bool DisableComAgent; bool DisableInstantMessaging; MD_AutoResponder DNDSchedule; int Priority; }; GroupName - the name of the group Description - a brief description of the group TemplateName - optional name of an account template to associate with this group. ADGroupName - optional name of an Active Directory group to associate with this group. Priority - the relative priority value for the group (from 1-1000) DisableComAgent - disable ComAgent entirely DisableInstantMessaging - disable instant messaging function of ComAgent DNDSchedule - filled in with "Do Not Disturb" (see manual). This fits into an MD_AutoResponder structure though only the StartTime, EndTime, Days, and Enabled members are used here.
voidMD_GroupInit( MD_Group* Group // Pointer to MD_Group structure const char* GroupName // Optional name of an existing group ) This function initializes the members of the Group structure passed to it. Parameters Group - a previously allocated MD_Group structure GroupName - group settings to load or NULL Return values none Remarks You should call this function before using an MD_Group structure to make sure members are properly initialized. If GroupName is not NULL then the Group structure is populated with the settings of GroupName (if it exists). The Priority member of the Group structure is initialized to DEFAULT_GROUP_PRIORITY (currently 500). Example MD_Group* Group = new MD_Group; MD_GroupInit(Group, NULL); strcpy(Group->GroupName, "My Group"); strcpy(Group->Description, "My sample group."); strcpy(Group->TemplateName, "New Accounts"); if (MD_GroupCreate(Group)) { // do something with Group } delete Group; Back to API reference
intMD_GroupInit() This function returns the number of groups that exist. Parameters none Return values Returns the number of groups that exist. Example int Count = MD_GroupGetCount(); Back to API reference
bool MD_GroupUpdate( MD_Group* OldGroup // Pointer to old MD_Group structure MD_Group* NewGroup // Pointer to new MD_Group structure ) This function updates OldGroup with the settings found in NewGroup. Parameters OldGroup - MD_Group structure with settings from an existing group. NewGroup - MD_Group structure containing new settings to change to. Return values Returns TRUE if successful, FALSE otherwise. Remarks Before changing a group's settings you must load up the existing settings into OldGroup, then make whatever changes you need by putting them into NewGroup (including the group name if necessary), and then call this function. Example MD_Group OldGroup; MD_GroupInit(&OldGroup, "My Group"); MD_Group NewGroup; memcpy(&NewGroup, &OldGroup, sizeof(MD_Group)); strcpy(NewGroup.GroupName, "My New Group"); strcpy(NewGroup.Description, "My new description."); strcpy(NewGroup.TemplateName, "My template for this group"); // optional if (MD_GroupUpdate(OldGroup, NewGroup)) { } Back to API reference
bool MD_GroupWrite( MD_Group* Group // Pointer to MD_Group structure to write ) This function writes a group's settings to disk. Parameters Group - MD_Group structure with settings for the group. Return values Returns TRUE if successful, FALSE otherwise. Remarks Call this function to write out a group to disk. Example MD_Group Group; MD_GroupInit(&Group, "My Group"); // Change the description for the group and write it back out strcpy(NewGroup.Description, "My new group description."); if (MD_GroupWrite(Group)) { } Back to API reference
bool MD_GroupGetADGroup( MD_Group* Group // Pointer to MD_Group structure to receive information const char* ADGroupName // Name of an active directory group ) This function checks to see if a group exists which is linked to an active directory group. Parameters Group - MD_Group structure to be filled in with group information. ADGroupName - The name of an active directory group Return values Returns TRUE if the group is linked to an active directory group, FALSE otherwise. Remarks Groups allow specification of an optional active directory group name. Use this function to find out if a group exists which has been linked to an active directory group name. If the function returns TRUE it means that a group has been linked to an active directory group. The linkage is used by MDaemon's Active Directory monitoring feature to test whether an account in Active Directory is part of group X and if so, they should be made part of the corresponding MDaemon group as well. Example const char ADGroupName = "Administrators"; MD_Group Group; if (MD_GroupGetADGroup(&Group, ADGroupName)) { // Group will now contain details about the MDaemon group which // is linked to the "Administrators" Active Directory group. } Back to API reference
void MD_GroupSetUserGroups( MD_HANDLE hUser // handle to a valid account record MD_UserInfo* UserInfo // UserInfo to receive group template settings const char* Groups // names of groups the account belongs too ) This function sets the group affiliations for an account. Parameters hUser - handle to a valid account record. UserInfo - pointer to MD_UserInfo structure. Groups - names of groups the account belongs to Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. UserInfo will be modified in accordance with the account template (if any) of the lowest priority group which has an account template. UserInfo can be NULL if you don't need to update the structure with account template changes. Groups is a comma separated list of one of more group names. Example MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); if (hUser != MD_BADHANDLE) { MD_UserInfo UserInfo; MD_InitUserInfo(&UserInfo); // After this call UserInfo will have all the settings of "arvel@altn.com" account MD_GetUserInfo(hUser, &UserInfo); // After this call UserInfo settings may change if "Administrators" or "Users" // have an account template assigned. MD_GroupSetUserGroups(hUser, &UserInfo, "Administrators,Users"); MD_SetUserInfo(hUser, &UserInfo); MD_GetFree(hUser); } Back to API reference
void MD_GroupGetUserGroups( MD_HANDLE hUser // handle to a valid account record char* Groups // buffer to receive group names ) This function gets the names of all groups the account belongs to. Parameters hUser - handle to a valid account record. Groups - buffer to receive names of groups the account belongs to in a comma delimited list (must be at least MAX_GROUPS_LEN+1 chars long) Return values none Remarks none Example char Groups[MAX_GROUPS_LEN+1]; MD_GroupGetUserGroups(Index, Groups); Back to API reference
char* MD_GroupGetAll() This function retrieves all the account groups known to MDaemon. Parameters none Return values If the number of groups is greater than zero, this function returns a pointer to a comma delimited list of all group names. Otherwise, the function returns zero. Remarks Group names are stored in GROUPS.DAT. The calling application must call MD_GroupFree to free the memory allocated by this function. Example char* Buffer = MD_GroupGetAll(); if (Buffer) { char* Group = strtok(Buffer, ","); while (Group) { // do something with Group Group = strtok(NULL, ","); } MD_GroupFree(Buffer); } Back to API reference
char* MD_GroupGetAllWithDesc( ) This function retrieves all the account groups and descriptions known to MDaemon. Parameters none Return values If the number of groups is greater than zero, this function returns a pointer to a double-null terminated list of strings. Each string contains a group name, followed by a semi-colon, followed by the description of the group. If no groups exist, the function returns zero. Remarks Group names and descriptions are stored in GROUPS.DAT. The calling application must call MD_GroupFree to free the memory allocated by this function. Example char* Buffer = MD_GroupGetAllWithDesc(); if (Buffer) { char* Group = Buffer; while (Group && Group[0] != '\0') { // do something with Group Group += strlen(Group) + 1; } MD_GroupFree(Buffer); } Back to API reference
void MD_GroupFree( char* Buffer // pointer to free ) This function frees memory allocated by other group related functions. Parameters Buffer - Pointer to be freed Return values none Remarks Some group related functions allocate memory which must be freed by calling this function. Example char* Groups = MD_GroupGetAll(); if (Groups) { // do something with Groups MD_GroupFree(Groups); }
Back to API reference void MD_GroupClearCache( ) This function clears internally cached group data for all threads. Parameters none Return values none Remarks Grouping data is internally cached to maximize performance. This function can be called to invalidate the cache. This is usually not needed as the functions in the API manage the cached data automatically. However, if direct edits are made to the disk file containing grouping data then this function should be called. Back to API reference
bool MD_GroupExists( const char* Group // name of a group ) This function tells whether or not a group exists. Parameters Group - the name of a group. Return values This function returns TRUE if Group exists, FALSE otherwise. Remarks none Example bool Result = MD_GroupExists("admins"); Back to API reference
bool MD_GroupFindMember( const char* Email // email address of potential group member const char* Group // name of group ) This function returns whether Email is a mamber of Group. Parameters Email - email address of potential group member Group - string containing a group name Return values This function returns TRUE if Email is a member of Group, FALSE otherwise. Remarks none Example char GroupName[20] = "administrators"; bool Result = MD_GroupFindMember("arvel@altn.com", GroupName); Back to API reference
char* MD_GroupGetMembers( const char* Group // name of a group ) This function returns a pointer to a list of group members. Parameters Group - the name of a group. Return values This function returns a pointer to a double-null terminated list of strings. Each string contains an email address that is a member of Group. If there are no members or if an error occurs the function returns 0. Remarks The pointer returned by this function must be deleted by calling MD_GroupFree. Example char* Buffer = MD_GroupGetMembers("MyGroup"); char* p = Buffer; while (*p) { // do something useful with p p += strlen(p)+1; } MD_GroupFree(p); Back to API reference
bool MD_GroupAddMember( const char* Email // email address to add to group const char* Group // name of a group ) This function adds a member to a group. Parameters Email - email address to add to a group. Group - the name of a group. Return values This function returns TRUE if the Email was added to Group, FALSE otherwise. Remarks Email must point to a valid local user account. If Email is already a member of Group the function returns FALSE. Example if (MD_GroupAddMember("arvel@altn.com", "admins")) { // arvel@altn.com is now a member of "admins" } Back to API reference
bool MD_GroupRemoveMember( const char* Email // email address to remove from group const char* Group // name of a group ) This function removes a member from a group. Parameters Email - email address to remove from a group. Group - the name of a group. Return values This function returns TRUE if the Email was removed from Group, FALSE otherwise. Remarks Email must point to a valid local user account. If Email is not a member of Group the function returns FALSE. If GROUP is NULL then Email is removed from all groups. Example if (MD_GroupRemoveMember("arvel@altn.com", "admins")) { // arvel@altn.com is no longer a member of "admins" } if (MD_GroupRemoveMember("arvel@altn.com", NULL)) { // arvel@altn.com was removed from all groups } Back to API reference
bool MD_GroupRenameMember( const char* OldEmail // existing email address const char* NewEmail // new email address ) This function renames a member in all groups to which the member belongs. Parameters OldEmail - email address of an existing group member. NewEmail - new email address for the existing group member. Return values This function returns TRUE if the existing member was renamed, FALSE otherwise. Remarks OldEmail is renamed to NewEmail for all groups to which the member belongs. Example if (MD_GroupRenameMember("arvel@altn.com", "arvel.hathcock@altn.com")) { // group membership has been updated } Back to API reference
bool MD_GroupCreate( MD_Group* Group // name of a group ) This function creates a group. Parameters Group - an MD_Group structure with details about the group. Return values This function returns TRUE if the group was created, FALSE otherwise. Remarks The Group structure passed to this function must have the GroupName and Description fields present. The TemplateName field is optional and only necessary if you wish to assign an account template to the group. If so, accounts will have the associated template settings applied when they are created or when they are made new members of the group. The function will also return FALSE if the group already exists. Example MD_Group Group; MD_GroupInit(&Group); strncpy(Group.GroupName, "Admins", MAX_GROUP_NAME_LEN); strncpy(Group.Description, "Users who can administer this mail server.", MAX_GROUP_DESC_LEN); if (MD_GroupCreate(&Group)) { // do something with the new group } Back to API reference
bool MD_GroupDelete( const char* Group // name of a group ) This function deletes a group. Parameters Group - the name of a group. Return values This function returns TRUE if the group was deleted, FALSE otherwise. The function returns FALSE if Group does not exist. Remarks Deleting a group also removes all members from the group. Example if (MD_GroupDelete("admins")) { // the group is gone, and all members have been removed from it } Back to API reference
bool MD_GroupRename( const char* Group // name of a group const char* NewName // new name for the group ) This function renames a group. Parameters Group - the name of an existing group. NewName - a new name for Group. Return values This function returns TRUE if the group was renamed, FALSE otherwise. The function returns FALSE if Group does not exist. The function returns FALSE if a group called NewName already exists. Remarks Renaming a group updates all members of the group automatically. Example if (MD_GroupRename("admins", "administrators")) { // the group has been renamed and all members have been updated } Back to API reference ---------------------------- ACCOUNT MANAGEMENT FUNCTIONS ---------------------------- The bulk of the functions within MDUSER.DLL pertain to account management. Several of these functions require an MD_UserInfo structure. So, we will begin by describing that. The MD_UserInfo structure is used to both set and retrieve user information. For example, when calling MD_GetUserInfo an MD_UserInfo structure is filled in with account details. When calling MD_SetUserInfo the MD_UserInfo structure is used to set account details and so must be filled in by your program prior to being used. For the following discussion the terms 'account' and 'user' are the same thing. #define DOMAIN_LEN 45 #define MAILBOX_LEN 30 #define FULLNAME_LEN 30 #define MAILDIR_LEN 90 #define PASSWORD_LEN 20 #define MAXMESSAGECOUNT_LEN 4 #define MAXDISKSPACE_LEN 6 #define EMAIL_LEN MAILBOX_LEN+DOMAIN_LEN+1 #define FWDADDR_LEN 256 #define FWDHOST_LEN 64 #define FWDSENDAS_LEN 128 #define USERDEFINED_LEN 256 struct MD_Forwarding { char Address[FWDADDR_LEN+1]; char Host[FWDHOST_LEN+1]; char SendAs[FWDSENDAS_LEN+1]; char Port[PORT_LEN+1]; }; struct MD_AutoResponder { bool Enabled; char Script[MAX_PATH+1]; char Process[MAX_PATH+1]; char Exclude[AUTORESPEXCLUDE_LEN+1]; char AddToList[EMAIL_LEN+1]; char RemoveFromList[EMAIL_LEN+1]; char StartTime[TIME_LEN+1]; char EndTime[TIME_LEN+1]; bool PassMessage; int Days; }; struct MD_UserInfo { char Email[EMAIL_LEN+1]; char Mailbox[MAILBOX_LEN+1]; char Domain[DOMAIN_LEN+1]; char FullName[FULLNAME_LEN+1]; char MailDir[MAILDIR_LEN+1]; char Password[PASSWORD_LEN+1]; bool AutoDecode; bool IsForwarding; char AccessType; bool AllowChangeViaEmail; bool KeepForwardedMail; bool HideFromEveryone; bool ProcessCalendarRequests; bool DeclineConflictingRequests; bool DeclineRecurringRequests; bool ApplyQuotas; bool EnableMultiPOP; bool CanModifyGAB; // Read-only as of 15.6; changes made are not saved long MaxMessageCount; long MaxDiskSpace; int WebConfig; char NTAccount[MAILBOX_LEN+1]; char MailFormat[MBXFORMAT_LEN+1]; MD_Forwarding Forwarding; MD_AutoResponder AutoResponder; int MultiPOPMaxMessageAge; long MultiPOPMaxMessageSize; bool RecurseIMAP; bool IsDisabled; bool CheckAddrBook; bool UpdateAddrBook; int MaxInactive; int MaxMessageAge; int MaxDeleteIMAPMessageAge; char Comments[COMMENT_LEN+1]; char UserDefined[USERDEFINED_LEN+1]; char Groups[MAX_GROUPS_LEN+1]; char TemplateName[MAX_TEMPLATE_NAME_LEN+1]; bool RestrictPOPAccess; bool RestrictIMAPAccess; bool RestrictWCAccess; bool RestrictWAAccess; bool UseDefaultPruning; bool AttachmentLinking; bool ExtractOutbound; bool ExtractInbound; bool EnableSubaddressing; bool IsDomainAdmin; bool IsFrozen; bool MustChangePassword; bool DontExpirePassword; bool ApplyDomainSignature; bool ExemptFromAuthMatch; bool EnableComAgent; bool EnableInstantMessaging; int MaxSentPerDay; }; Fields Email - this field contains the full email address for the account. Mailbox - this field contains the mailbox for the account. Domain - this field contains the domain the account belongs to. FullName - this field contains the user's full name. MailDir - this field contains the full path to the user's root mail dir. Password - this field contains the account's password. AutoDecode - TRUE if account is configured to auto-extract attachments. IsForwarding - TRUE if account is forwarding mail. AccessType - this field specifies whether POP, IMAP, or both access is allowed AllowChangeViaEmail - TRUE if account can change settings via email. KeepForwardedMail - TRUE if account retains local copy of forwarded mail. HideFromEveryone - TRUE if account is hidden 'Everyone' mailing list. ProcessCalendarRequests - TRUE if account honors incoming calendar requests. DeclineConflictingRequests - TRUE if account rejects conflicting calendar requests. DeclineRecurringRequests - TRUE if account rejects recurring calendar requests. ApplyQuotas - TRUE if quotas are applied to account. EnableMultiPOP - TRUE if MultiPOP collection for account is active. CanModifyGAB - TRUE if the account can modify the WorldClient global address book. This member is read-only. MaxMessageCount - number of message account is allowed to store. MaxDiskSpace - number (in kilobytes) account's mail store can consume. WebConfig - bitmask specifying which WebConfig access rights are allowed. NTAccount - NT account name. MailFormat - mailbox storage format (MBF) file account is using. Forwarding->Address - the last known address the account is/was forwarding mail to. Forwarding->Host - the last known host the account is/was forwarding mail thru. Forwarding->SendAs - the last known HELO/EHLO value the account is/was using. Forwarding->Port - the last known port the account was forwarding mail on. AutoResponder->Script - this is the full path to the account's auto responder script file. AutoResponder->Process - this is the full path to a program the auto responder will execute. AutoResponder->Exclude - this is a double null terminated list of addresses that are exempt from receiving the AutoRespScript file. AutoResponder->AddToList - this is the mailing list the auto responder will sign people up to. AutoResponder->RemoveFromList - this is the mailing list the auto responder will remove people from. AutoResponder->PassMessageToProcess - TRUE if the message file triggering the auto responder should be passed to the AutoRespProcess program. AutoResponder->StartTime - starting date/time of autoresponder AutoResponder->EndTime - ending date/time of autoresponder AutoResponder->Days - which days of week the autoresponder works on MultiPOPMaxMessageAge - max number of days to leave messages on MultiPOP servers MultiPOPMaxMessageSize - max message size MultiPOP collection will honor. RecurseIMAP - TRUE if automatic pruning of old mail should recurse all IMAP folders. MaxInactive - number of days of inactivity before account is automatically removed. MaxMessageAge - number of days old a message can be before automatically being removed from mailbox. Comments - commentary text on this account. UserDefined - user defined. Groups - groups the account belongs too TemplateName - account template (if any); used internally to apply template settings when account created; reserved for internal use only. RestrictPOPAccess - TRUE means POP access restricted to local LAN IPs only RestrictIMAPAccess - TRUE means IMAP access restricted to local LAN IPs only RestrictWCAccess - TRUE means WorldClient access restricted to local LAN IPs only RestrictWAAccess - TRUE means WebAdmin access restricted to local LAN IPs only UseDefaultPruning - TRUE means account uses domain default pruning settings AttachmentLinking - TRUE means account uses attachment linking feature (set AutoDecode member to FALSE) ExtractOutbound - TRUE means attachment linking extracts attachments from outbound messages ExtractInbound - TRUE means attachment linking extracts attachments from inbound messages EnableSubaddressing - TRUE if account can use subaddressing IsDomainAdmin - TRUE if account is a administrator of his/her domain IsFrozen - TRUE if account is frozen (can receive but can't send or check mail) MustChangePassword - TRUE if account must change password DontExpirePassword - TRUE if account is exempt from the password expiration feature ApplyDomainSignature - TRUE if account should have domain signature affixed to outbound mail MaxSentPerDay - max number of emails allowed to send per day ExemptFromAuthMatch - TRUE if account is exempt from authentication matching email sender ComAgent - TRUE if ComAgent use is authorized EnableInstantMessaging - TRUE if ComAgent instant messaging is authorized Remarks When retrieving account information all these structure members will be filled in by MDaemon. When setting account information your application must fill in these data fields. The Password field contains the account's password in an unencrypted state. The WebConfig field is a bitmask that controls which access rights the account may have. Value masks are: MDUSERDLL_ACCESSWORLDCLIENT // account can access WorldClient MDUSERDLL_ACCESSWEBCONFIG // account can access WebConfig MDUSERDLL_ISADMIN // account has admin level access MDUSERDLL_EDITFULLNAME // account can change full name MDUSERDLL_EDITPASSWORD // account can change password MDUSERDLL_EDITMAILDIR // account can change mail directory MDUSERDLL_EDITFWD // account can change forwarding settings MDUSERDLL_EDITADVFWD // account can change adv. forwarding settings MDUSERDLL_EDITEVERYONE // account can change hide from everyone flag MDUSERDLL_EDITMAILRESTRICTIONS // account can change the mail restriction settings MDUSERDLL_EDITQUOTAS // account can change quota settings MDUSERDLL_EDITMULTIPOP // account can change multipop data MDUSERDLL_EDITAUTORESPONDER // account can change autoresponder settings MDUSERDLL_EDITIMAPRULES // account can change IMAP mail rules via email The NTAccount field is only used by MDaemon during an import from the NT database operation. This field is not maintained by MDaemon. Its content is only valid during an import operation. IMAP rules are only available in the PRO version of MDaemon. The MaxDiskSpace and MultiPOPMaxMessageSize fields are values specified in KILOBYTES. The AccessType field can be one of the following values: 'Y' - the account can be accessed by both POP and IMAP 'N' - the account can't be accessed by either POP or IMAP 'P' - the account can only be accessed using POP 'I' - the account can only be accessed using IMAP 'C' - the account is completely disabled and can not be used at all The Autoresponder->Days field is a bitmask of the following which should be ORed together: AR_MONDAY AR_TUESDAY AR_WEDNESDAY AR_THURSDAY AR_FRIDAY AR_SATURDAY AR_SUNDAY Back to API reference
int MD_UserCount() This function returns the total number of accounts in the account database. Parameters none Return value This function returns the total number of accounts in the account database. Example int Count = MD_UserCount(); Back to API reference
MD_FINDHANDLE MD_FindFirst( MD_HANDLE* hUser ) This function starts an iteration across the entire account database. Parameters hUser - pointer to an MD_HANDLE that receives the handle of the first account. Return values This function returns MD_BADFINDHANDLE if there are no accounts defined. Otherwise, it returns a valid MD_FINDHANDLE and sets hUser to a handle to the first account. Remarks This function is used to begin an iteration process. It is used in conjunction with MD_FindNext to perform operations on all accounts. The find handle that is returned by this function must be released by calling MD_FindClose. The account handle is released by MD_FindNext. If you do not call MD_FindNext, you should call MD_GetFree to release it. Example MD_HANDLE hUser; MD_FINDHANDLE hFind = MD_FindFirst(&hUser); if (hFind != MD_BADFINDHANDLE) { do { MD_UserInfo UserInfo; MD_GetUserInfo(hUser, &UserInfo); // do something useful with UserInfo } while (MD_FindNext(hFind, &hUser)); MD_FindClose(hFind); } Back to API reference
bool MD_FindNext( MD_FINDHANDLE hFind // find handle from MD_FindFirst MD_HANDLE* hUser // account handle from a previous call // to MD_FindFirst or MD_GetNextUser ) This function increments the search index to the next account. Parameters hFind - find handle returned by MD_FindFirst. hUser - pointer to an MD_HANDLE that receives the handle of the next account. The current handle that it points to is released Return values This function returns TRUE if there was another account, otherwise FALSE. Remarks The MD_FindFirst and MD_FindNext functions should be used when you need to iterate across every account in the database. The account handle is released by the next call to MD_FindNext. If you do not call MD_FindNext again, you should call MD_GetFree to release it. Example MD_HANDLE hUser; MD_FINDHANDLE hFind = MD_FindFirst(&hUser); if (hFind != MD_BADFINDHANDLE) { do { MD_UserInfo UserInfo; MD_GetUserInfo(hUser, &UserInfo); // do something useful with UserInfo } while (MD_FindNext(hFind, &hUser)); MD_FindClose(hFind); } Back to API reference
void MD_FindClose( MD_FINDHANDLE hFind // find handle from MD_FindFirst ) This function releases the find handle returned from MD_FindFirst. Parameters hFind - find handle returned by MD_FindFirst. Return values none Remarks Not calling this function can cause a memory leak. Do not attempt to use the find handle again after releasing it. Example MD_HANDLE hUser; MD_FINDHANDLE hFind = MD_FindFirst(&hUser); if (hFind != MD_BADFINDHANDLE) { do { MD_UserInfo UserInfo; MD_GetUserInfo(hUser, &UserInfo); // do something useful with UserInfo } while (MD_FindNext(hFind, &hUser)); MD_FindClose(hFind); } Back to API reference
MD_HANDLE MD_GetByEmail( const char* Email // email address of account to find ) This function searches the account database and returns the handle of the account which matches Email. Parameters Email - email address of account to look for Return values This function returns the database handle of the account which matches Email. It returns MD_BADHANDLE if no matching account is present. Remarks Use this function to retrieve the database handle of an account record when you know the email address of the account. The handle must be released after you're finished using it by calling MD_GetFree. Example MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); if (hUser != MD_BADHANDLE) { MD_UserInfo UserInfo; MD_GetUserInfo(hUser, &UserInfo); // do something with UserInfo MD_GetFree(hUser); } else // handle error Back to API reference
MD_HANDLE MD_GetByFullName( const char* FullName // full name of account to find const char* Domain // domain to search ) This function searches the account database records for the Domain domain and returns the handle of the account which matches FullName. Parameters FullName - full name to search for Domain - domain to search for record matching FullName Return values This function returns the database handle of the account which is a member of Domain and which matches FullName. It returns MD_BADHANDLE if no matching account is present. Remarks Use this function to retrieve the database handle of an account record when you know the full name of the account. Since users with the same full name can be present across multiple different domains you must also specify the domain the search should be restricted to. The handle must be released after you're finished using it by calling MD_GetFree. Example MD_HANDLE hUser = MD_GetByFullName("Arvel Hathcock", "altn.com"); if (hUser != MD_BADHANDLE) { MD_UserInfo UserInfo; MD_GetUserInfo(hUser, &UserInfo); // do something with UserInfo MD_GetFree(hUser); } else // handle error Back to API reference
MD_HANDLE MD_GetByMailbox( const char* Mailbox // mailbox of account to find const char* Domain // domain to search ) This function searches the account database records for the Domain domain and returns the handle of the account which matches Mailbox. Parameters Mailbox - mailbox to search for Domain - domain to search for record matching Mailbox Return values This function returns the database handle of the account which is a member of Domain and which matches Mailbox. It returns MD_BADHANDLE if no matching account is present. Remarks Use this function to retrieve the database handle of an account record when you know the mailbox of the account. Since users with the same mailbox can be present across multiple different domains you must also specify the domain the search should be restricted to. Ordinarily this function is not useful since if you know the mailbox and the domain you know the email address and can simply call MD_GetByEmail. The handle must be released after you're finished using it by calling MD_GetFree. Example MD_HANDLE hUser = MD_GetByMailbox("arvel", "altn.com"); if (hUser != MD_BADHANDLE) { MD_UserInfo UserInfo; MD_GetUserInfo(hUser, &UserInfo); // do something with UserInfo MD_GetFree(hUser); } else // handle error Back to API reference
MD_HANDLE MD_GetByMailDir( const char* MailDir // mail directory of account to find const char* Domain // domain to search ) This function searches the account database records for the Domain domain and returns the handle of the account which matches MailDir. Parameters MailDir - Mail directory to search for Domain - domain to search for record matching MailDir Return values This function returns the database handle of the account which is a member of Domain and which matches MailDir. It returns MD_BADHANDLE if no matching account is present. Remarks Use this function to retrieve the database handle of an account record when you know the mail directory of the account. Since users with the same mail directory can be present across multiple different domains (although this is highly discouraged) you must also specify the domain the search should be restricted to. It is sometimes useful to share the same mail directory for multiple accounts but not often. The handle must be released after you're finished using it by calling MD_GetFree. Example MD_HANDLE hUser = MD_GetByMailDir("C:\\mdaemon\\users\\arvel\\", "altn.com"); if (hUser != MD_BADHANDLE) { MD_UserInfo UserInfo; MD_GetUserInfo(hUser, &UserInfo); // do something with UserInfo MD_GetFree(hUser); } else // handle error Back to API reference
MD_HANDLE MD_GetByAlias( const char* Email // email address or alias of account to find const char* IP // optional IP address ) This function translates Email into a valid account if it is an alias and then searches the account database and returns the handle of the account which matches Email. Parameters Email - pointer to buffer containing an email address or alias. IP - optional pointer to buffer containing an IP address Return values This functions returns the database handle of the account which matches Email. It returns MD_BADHANDLE if no matching account is present. The handle must be released after you're finished using it by calling MD_GetFree. Remarks The optional IP parameter is used only rarely. If Email does not contain a full email address (if it is a mailbox value only) an IP address in dotted decimal form can be passed. MDUSER.DLL will then perform a lookup into MDaemon's configuration files to determine which domain the IP belongs to. If a match is found then that is the domain that will be assumed to pertain to Email. If a match is NOT found the the primary domain will be used. The handle must be released after you're finished using it by calling MD_GetFree. Example Assume an alias exists within MDaemon: arvel@altn.com = frank@thomas.com char Email[EMAIL_LEN+1]; strcpy(Email, "arvel@altn.com"); MD_HANDLE hUser = MD_GetByAlias(Email, ""); if (hUser != MD_BADHANDLE) { // 'frank@thomas.com' is a local account! MD_GetFree(hUser); } else // 'frank@thomas.com' is NOT a local account. Back to API reference
void MD_GetFree( MD_HANDLE hUser // account handle to free ) This function frees internal memory associated with an account handle. Parameters hUser - Account handle to free. Account handles are returned by the MD_GetByXXX functions and MD_FindFirst/MD_FindNext. Return values none Remarks Not calling this function can cause a memory leak. Do not attempt to use the account handle again after releasing it. Example MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); MD_GetFree(hUser); Back to API reference
bool MD_UserExists( const char* address // email address to look for ) This function returns TRUE if address is a local email account, is an alias for a local email account, or is a mailing list name. Parameters address - email address to look for Return value TRUE if the address is found, otherwise FALSE. Example if (MD_UserExists("arvel@altn.com")) // do something useful Back to API reference
void MD_InitUserInfo( MD_UserInfo* UserInfo // pointer to MD_UserInfo structure ) The MD_InitUserInfo structure is used to initialize all the members of the UserInfo structure to the correct defaults. Parameters UserInfo - pointer to an MD_UserInfo structure Return values None Remarks This function should be called immediately after declaring an MD_UserInfo variable. It is used to initialize all the members within the structure to the defaults for new accounts you have specified within MDaemon. Example MD_UserInfo UserInfo; MD_InitUserInfo(&UserInfo); Back to API reference
int MD_VerifyUserInfo( MD_UserInfo* UserInfo // pointer to MD_UserInfo structure int Level // bit-mask specifying verification level ) This function verifies the integrity of UserInfo. Parameters UserInfo - pointer to an MD_UserInfo structure containing the details of an account which need to be verified. Level - bit-masked integer used to specify how detailed a verification should be performed on UserInfo. Valid masks are: MDUSERDLL_VRFYACCOUNT - The Domain, Mailbox, FullName, and Password members within UserInfo will be checked for syntactical errors and use of reserved names. MDUSERDLL_VRFYMAILDIR - The MailDir member within UserInfo will be checked for syntactical errors. MDUSERDLL_VRFYFWD - The FwdAddress and IsForwarding members within UserInfo are verified. MDUSERDLL_VRFYQUOTAS - The MaxMessageCount and MaxDiskSpace members within UserInfo are verified. MDUSERDLL_VRFYOPTIONS - reserved MDUSERDLL_VRFYWEBCONFIG - reserved MDUSERDLL_VRFYMULTIPOP - reserved MDUSERDLL_VRFYALL - Verifies all the above elements. Return values MDDLLERR_NOERROR - no errors are present within UserInfo. MDDLLERR_INVALIDMAILBOX - returned if the Mailbox member within UserInfo is missing, contains a syntax error, or is set to a reserved value such as 'ListServ' or 'ProcNow'. MDDLLERR_INVALIDDOMAIN - returned if the Domain member within UserInfo is missing or contains a syntax error. MDDLLERR_NONLOCALDOMAIN - returned if the Domain member is not one of MDaemon's primary or secondary domains. MDDLLERR_POSTMASTER - returned if the Mailbox or FullName members within UserInfo is set to 'Postmaster'. The Postmaster account must be an alias. MDDLLERR_MBXHASDOMAIN - returned if the Mailbox member within UserInfo contains an '@' character. MDDLLERR_INVALIDFULLNAME - returned if the FullName member within UserInfo is missing, contains a syntax error, or is set to a reserved value such as 'MDaemon', 'ProcNow', etc. MDDLLERR_INVALIDPASSWORD - returned if the Password member within the UserInfo structure is missing, contains a syntax error, or is longer than 15 characters. MDDLLERR_INVALIDMAILDIR - returned if the MailDir member within the UserInfo structure is missing or contains a syntax error. Remarks This function should be called whenever the integrity of the data within UserInfo needs to be verified. MD_AddUser() automatically calls this function to verify UserInfo before adding new accounts. If Level includes MDUSERDLL_VRFYACCOUNT then the Domain, Mailbox, FullName, and Password members of the UserInfo structure are checked to make sure they are not missing. The Mailbox member is checked to ensure that it doesn't contains an '@' symbol. The 15 character limitation on the Password member within UserInfo is required due to the nature of the encryption method used upon it. This method is a 4 for 3 substitution algorithm which means a 20 byte space within the user record can only contain a 15 character value. This limitation is not imposed on dynamic password. Those may use the full length of the password field. if Level includes MDUSERDLL_VRFYMAILDIR the value of MailDir within the UserInfo structure will be certain to have a trailing backslash. if Level includes MDUSERDLL_VRFYFWD and the FwdAddress member within the UserInfo structure is missing the IsForwarding member will be set to FALSE. if Level includes MDUSERDLL_VRFYQUOTAS the MaxDiskSpace and MaxMessageCount members within UserInfo will be certain to contain valid values. When calling this function set Level to MDUSERDLL_VRFYALL to verify all the members of the UserInfo structure. Example MD_UserInfo UserInfo; MD_InitUserInfo(&UserInfo); // Check account related members only if (MD_VerifyUserInfo(&UserInfo, MDUSERDLL_VRFYACCOUNT) == MDDLLERR_NOERROR) // do whateverr else // handle error // Check account and forwarding members only if (MD_VerifyUserInfo(&UserInfo, MDUSERDLL_VRFYACCOUNT | MDUSERDLL_VRFYFWD) == MDDLLERR_NOERROR) // do whateverr else // handle error // Check all members if (MD_VerifyUserInfo(&UserInfo, MDUSERDLL_VRFYALL) == MDDLLERR_NOERROR) // do whateverr else // handle error Back to API reference
int MD_AddUser( MD_UserInfo* UserInfo // pointer to MD_UserInfo structure int Flags // reserved, must be 0 ) This function adds a new account to MDaemon's account database. Parameters UserInfo - pointer to an MD_UserInfo structure containing the details of the new account Flags - reserved, must be 0 Return values This function calls MD_VerifyUserInfo() passing MDUSERDLL_VRFYALL and will return any error returned from that function. MDDLLERR_TOOMANYACCOUNTS - returned if adding the new account would exceed the maximum allowed. MDDLLERR_USEREXISTS - retured if the new account would conflict with an existing account. Remarks This function will add a new account to MDaemon's account database. After successfully adding the account, MDUSER.DLL will send the WM_MDUSERDLL_MSG message passing WM_MDUSERDLL_ADD as the WPARAM argument to all registered applications (see MD_RegisterWindow). Example MD_UserInfo UserInfo; // Copy new account defaults into structure MD_InitUserInfo(&UserInfo); // copy data into UserInfo members strcpy(UserInfo.FullName, "Arvel Hathcock"); strcpy(UserInfo.Domain, "altn.com"); strcpy(UserInfo.Mailbox, "arvel"); strcpy(UserInfo.MailDir, "c:\\mdaemon\\users\\arvel\\"); if (MD_AddUser(&UserInfo, 0) == MDDLLERR_NOERROR) // account added ok else // handle error Back to API reference
bool MD_DeleteUser( char* Email // email address of account to be deleted int Flags // bit-mask specifying deletion level ) This function deletes an account from MDaemon's account database and from any associated database (such as auto responder, forwarding, etc..) Parameters Email - the complete email address of the account to be deleted Flags - bit-mask specifying the level of deletion that should be performed on Email. Valid values are: MDUSERDLL_DUSERLISTDB - remove the account from the account database. MDUSERDLL_DAUTORESPDB - remove the account's auto responder database entries. MDUSERDLL_DFWDDB - remove the account's mail forwarding database entries. MDUSERDLL_DMAILFORMATDB - remove the account's mail format database entry. MDUSERDLL_DMULTIPOPDB - remove the account's MultiPOP database entries. MDUSERDLL_DALIASDB - remove the account's address alias database entries. MDUSERDLL_DREMOVEDIR - remove the account's mail directory and delete all mail. MDUSERDLL_DDELETEALL - removes all of the above items completely deleting the account. Return values This function returns TRUE if the delete operation was successful, otherwise returns FALSE. If Flags includes MDUSERDLL_DUSERLISTDB and the operation is successful MDUSER.DLL will send the WM_MDUSERDLL_MSG message passing WM_MDUSERDLL_DELETE as the WPARAM argument to all registered applications (see MD_RegisterWindow). Remarks Use this function to delete an entry either in part or in whole. This function should not be called from within MD_FindNext loop. Example // Delete the account's alias entries if (MD_DeleteUser("arvel@altn.com", MDUSERDLL_DALIASDB)) // do whateverr else // handle error // Delete the account's MultiPOP entries and auto responder if (MD_DeleteUser("arvel@altn.com", MDUSERDLL_DMULTIPOPDB | MDUSERDLL_DAUTORESPDB)) // do whateverr else // handle error // Completely delete the account - bye bye if (MD_DeleteUser("arvel@altn.com", MDUSERDLL_DDELETEALL)) // do whateverr else // handle error Back to API reference
void MD_ChangeUser( MD_UserInfo* UserInfo // old pre-change account information char* NewEmail // email address post change bool UpdateMailDir // update mail location? ) This function updates database files to reflect new account information. Parameters UserInfo - pointer to MD_UserInfo structure which contains the old account settings prior to any changes. NewEmail - pointer to the new email address AFTER all changes have been made. UpdateMailDir - TRUE if account's mail should be moved to a new location when a domain used in a mail directory has been changed. Return values none Remarks This function is not normally and should not normally be called from your application. Applications should use MD_SetUserInfo to properly commit account changes to disk. This function is only provided for cases in which an application makes direct disk edits to the account database and needs to reflect those changes to other databases. Example MD_UserInfo OldUserInfo; MD_GetUserInfo(hUser, &OldUserInfo); // make your direct edits to MDaemon configuration files here MD_ChangeUser(&OldUserInfo, "newmailbox@domain.com", FALSE); Back to API reference
MD_UserInfo* MD_GetUserInfo( MD_HANDLE hUser // handle of account record to retrieve MD_UserInfo* UserInfo // structure which will retain account info ) This function retrieves a complete account record. Parameters hUser - handle of account record to retrieve. UserInfo - pointer to MD_UserInfo structure which will be filled with account data. Return values This function returns UserInfo. Remarks If hUser is invalid, UserInfo will be initialized to default settings (see MD_InitUserInfo). Otherwise, UserInfo is filled with the settings associated with the account specified by hUser. Use one of the search functions to retrieve the handle for a specific account. Example MD_UserInfo UserInfo; MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); if (hUser != MD_BADHANDLE) { MD_GetUserInfo(hUser, &UserInfo); // do something with UserInfo MD_GetFree(hUser); } else // handle error Back to API reference
bool MD_SetUserInfo( MD_HANDLE hUser // handle of account record to store MD_UserInfo* UserInfo // structure which will contain account info ) This function commits a complete account record to disk. Parameters hUser - handle of account record to store. UserInfo - pointer to MD_UserInfo structure which must contain valid account data. Return values This function returns TRUE if hUser points to a valid account, FALSE otherwise. Remarks This function commits changes made to an account record to disk. Each member of UserInfo is updated to disk. It is important that the data be correct and verified using MD_VerifyUserInfo. MDUSER.DLL will send the WM_MDUSERDLL_MSG message passing WM_MDUSERDLL_CHANGE as the WPARAM argument to all registered applications (see MD_RegisterWindow). Example MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); if (hUser != MD_BADHANDLE) { MD_UserInfo UserInfo; MD_GetUserInfo(hUser, &UserInfo); strcpy(UserInfo.Mailbox, "frank"); strcpy(UserInfo.Domain, "thomas.com"); if (MD_VerifyUserInfo(&UserInfo, MDUSERDLL_VRFYALL) == MDDLLERR_NOERROR) MD_SetUserInfo(hUser, &UserInfo); else // handle error MD_GetFree(hUser); } else // handle error Back to API reference
bool MD_LogonUser( const char* Email // email address or alias const char* Password // password const char* IP // optional IP address ) This function performs a logon attempt. Parameters Email - pointer to buffer containing an email address or alias. Password - pointer to buffer containing an account password. IP - optional pointer to buffer containing an IP address Return values This function returns true if Password matches the password for Email. In other words if Email and Password correspond to a valid local account this function returns TRUE. It otherwise returns FALSE. Remarks A check is made to see if Email is a valid local account or an alias to a local account. If so, then that accounts password is compared to Password and the result is returned. The optional IP parameter is used only rarely. If Email does not contain a full email address (if it is a mailbox value only) an IP address in dotted decimal form can be passed. MDUSER.DLL will then perform a lookup into MDaemon's configuration files to determine which domain the IP belongs to. If a match is found then that is the domain that will be assumed to pertain to Email. If a match is NOT found the the primary domain will be used. This function actually calls MD_GetByAlias and MD_ValidateUser to perform the work. Example Assume 'arvel@altn.com' is a local account with password 'ALTN' char Email[EMAIL_LEN+1]; strcpy(Email, "arvel@altn.com"); if (MD_LogonUser(Email, "ALTN", "")) // account is local and 'ALTN' is the correct password else // incorrect password or Email is not local Back to API reference
bool MD_ValidateUser( MD_HANDLE hUser // handle to a valid account database record const char* Password // password ) This function performs a logon attempt. Parameters hUser - handle of the account database record about to be verified. Password - pointer to buffer containing an account password. Return values This function returns true if Password matches the password for the account pointed to by hUser. It otherwise returns FALSE. Remarks Unlike MD_LogonUser, this function does not perform any address alias translation and requires a valid handle to an account record. It is therefore only applicable in a situation where you already have a valid account handle and are only interested in determining the validity of the account's password. If the account is configured for dynamic Windows NT authentication then MDUSER.DLL attempts to verify the Password by attempting a logon to the NT domain the account is configured to use. If the logon is successful the function returns TRUE otherwise FALSE. Example MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); if (hUser != MD_BADHANDLE) { if (MD_ValidateUser(hUser, "ALTN")) // the password is correct for this account MD_GetFree(hUser); } Back to API reference
bool MD_ImportUsers( const char* Path // path to comma separated values file containing accounts to import HWND hWnd // optional callback window int& sCount // variable to receive the number of accounts successfully imported int& fCount // variable to receive the number of import failures ) This function attempts to import accounts from a comma separated values (CSV) file. Parameters Path - path to comma separated values file containing accounts to import. hWnd - optional window handle which will receive callbacks - 0 or NULL means no callbacks sCount - variable to receive the number of accounts successfully imported fCount - variable to receive the number of import failures Return values none Remarks The first line of Path is expected to be a base line giving the names and sequence of the fields in subsequent lines. For example: "Mailbox", "FullName", "MailDir" "arvel", "Arvel Hathcock", "C:\Mail\Arvel\" "frank", "Frank Thomas", "C:\Mail\Frank\" The field names used in the base line are used by the API to determine the data sequence and therefore can appear in any order. Use the following values in the base line to map to MDaemon account fields: Field Name Type -------------------------------- MailBox String Domain String FullName String MailDir String Password String AutoDecode bool IsForwarding bool AccessType char AllowChangeViaEmail bool KeepForwardedMail bool HideFromEveryone bool ProcessCalendarRequests bool ApplyQuotas bool EnableMultiPOP bool MaxMessageCount int MaxDiskSpace int FwdAddress String FwdHost String FwdSendAs String FwdPort String NTAccount String MailFormat String AutoRespScript String AutoRespProcess String AddToList bool RemoveFromList bool PassMessageToProcess bool MultiPOPMaxMessageAge int MultiPOPMaxMessageSize int RecurseIMAP bool MaxInactive int MaxMessageAge int MaxDeletedIMAPMessageAge int Comments String UserDefined String Groups String -------------------------------- When hWnd is non-NULL the API will send a WM_MDUSERDLL_MSG message each time a record is imported. If the record was successfully imported the WPARAM of this message will be WM_MDUSERDLL_IMPORT_S and the LPARAM will be equal to the current value of sCount. If the import attempt results in an error the WPARAM will be WM_MDUSERDLL_IMPORT_F and the LPARAM will be equal to the current value of fCount; If hWnd is provided and then becomes invalid this function immediately returns. This will allow you to place a Cancel button on hWnd and abort the function if needed. If it critical that your hWnd process the message sent in a timely fashion. The API is on hold until your function returns from processing these messages. When hWnd is NULL (or zero) no callbacks are performed. This function creates TXIMPORT.LOG in the MDaemon APP directory which contains detailed information on the entire import process. Example int sCount = 0; int fCount = 0; HWND hWnd = *this; MD_ImportUsers("C:\\MDaemon\\App\\Accounts.csv", hWnd, sCount, fCount); (handler will process callbacks callbacks) char WorkBuffer[256]; sprintf(WorkBuffer, "Success: %d, Failed: %d", sCount, fCount); Back to API reference
void MD_FilterUserInfo( MD_UserInfo* UserInfo // UserInfo structure containing account details ) This function takes the members of UserInfo that are given and expands the default Mailbox, Password, and MailDir templates. It also fills in the full name field if it is missing. Parameters UserInfo - pointer to MD_UserInfo structure which will be updated with new values for the Mailbox, Password, and MailDir members. Return value none Remarks This function takes a UserInfo structure that contains empty Mailbox, Password, and MailDir members and expands them according to the new account default settings within MDaemon. For example, if the MailDir template for new accounts is set to: C:\MDaemon\Users\$DOMAIN$\$MAILBOX$\ then this function can be called to expand that template and place the result into the MailDir member. The Mailbox, Password, and MailDir members must be empty or they will not be altered. If the Full Name field is empty the Mailbox field content will be copied into the Full Name field. MD_FilterUserInfo filters each string by passing it to MD_FilterString. Example Assume the following template values for new accounts are configured within MDaemon: MailBox: $USERFIRSTINITIAL$$USERLASTNAME$ Password: Pass-$USERFIRSTNAME$ MailDir: C:\MDaemon\Users\$DOMAIN$\$MAILBOX$\ MD_UserInfo UserInfo; MD_InitUserInfo(&UserInfo); // at this point UserInfo.Mailbox, UserInfo.Password, and UserInfo.MailDir // will be empty strings. strcpy(UserInfo.FullName, "Arvel Hathcock"); strcpy(UserInfo.Domain, "altn.com"); MD_FilterUserInfo(&UserInfo); // at this point UserInfo.Mailbox will be 'AHathcock', UserInfo.Password // will be 'Pass-Arvel', and UserInfo.MailDir will be // 'C:\MDaemon\Users\altn.com\AHathcock\' Back to API reference
char* MD_FilterString( char* Buffer // buffer containing macros to be filtered int BufLen // maximum length of buffer MD_UserInfo* UserInfo // account settings ) This function takes data from UserInfo using it to replace macros contained in Buffer. Parameters Buffer - pointer to string containing macros to be filtered (expanded). BufLen - the maximum length of Buffer. UserInfo - structure containing user data. This data is used to expand macros found in Buffer. Return values This function returns the filtered (expanded) string. Remarks This function is used to transform a string with macros into a string with real data. For example, if Buffer was equal to 'C:\MDaemon\Users\$DOMAIN$\ $MAILBOX$\' data from UserInfo would be taken to fill the $DOMAIN$ and $MAILBOX$ macros. For a complete list of macros available for use with this function consult the MDaemon manual. Example char MyTemplate[256]; strcpy(MyTemplate, "New account for $DOMAIN$ added, mailbox = $MAILBOX$"); MD_UserInfo UserInfo; MD_GetUserInfo(hUser, &UserInfo) FilterString(MyTemplate, 255, &UserInfo); Back to API reference
char* MD_GetEmail( MD_HANDLE hUser // handle to a valid account record char* Buffer // buffer to contain new data ) This function gets the email address for the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer to retrieve account data. Return values This function returns Buffer or '\0' if hUser does not point to a valid account. Remarks Buffer must be at least EMAIL_LEN+1 chars long. Example char Buffer[EMAIL_LEN+1]; MD_GetEmail(hUser, Buffer); Back to API reference
char* MD_GetMailbox( MD_HANDLE hUser // handle to a valid account record char* Buffer // buffer to contain new data ) This function gets the mailbox for the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer to retrieve account data. Return values This function returns Buffer or '\0' if hUser does not point to a valid account. Remarks Buffer must be at least MAILBOX_LEN+1 chars long. Example char Buffer[MAILBOX_LEN+1]; MD_GetMailbox(hUser, Buffer); Back to API reference
void MD_SetMailbox( MD_HANDLE hUser // handle to a valid account record const char* Buffer // buffer containing new data ) This function sets the mailbox for the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer containing new account data. Return values none Remarks Care should be taken to ensure setting mailbox to Buffer will not cause a conflict with another account. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetMailbox(hUser, "newmailbox"); Back to API reference
char* MD_GetDomain( MD_HANDLE hUser // handle to a valid account record char* Buffer // buffer to contain new data ) This function gets the domain for the account specified by handle. Parameters hUser - handle to a valid account record. Buffer - buffer to retrieve account data. Return values This function returns Buffer or '\0' if hUser does not point to a valid account. Remarks Buffer must be at least DOMAIN_LEN+1 chars long. Example char Buffer[DOMAIN_LEN+1]; MD_GetDomain(hUser, Buffer); Back to API reference
void MD_SetDomain( MD_HANDLE hUser // handle to a valid account record const char* Buffer // buffer containing new data ) This function sets the domain for the account specified by handle. Parameters hUser - handle to a valid account record. Buffer - buffer containing new account data. Return values none Remarks Care should be taken to ensure setting domain to Buffer will not cause a conflict with another account. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetDomain(hUser, "altn.com"); Back to API reference
char* MD_GetFullName( MD_HANDLE hUser // handle to a valid account record char* Buffer // buffer to contain new data ) This function gets the full name for the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer to retrieve account data. Return values This function returns Buffer or '\0' if hUser does not point to a valid account. Remarks Buffer must be at least FULLNAME_LEN+1 chars long. Example char Buffer[FULLNAME_LEN+1]; MD_GetFullName(hUser, Buffer); Back to API reference
void MD_SetFullName( MD_HANDLE hUser // handle to a valid account record const char* Buffer // buffer containing new data ) This function sets the full name for the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer containing new account data. Return values none Remarks Care should be taken to ensure setting full name to Buffer will not cause a conflict with another account. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetFullName(hUser, "Frank Thomas"); Back to API reference
char* MD_GetMailDir( MD_HANDLE hUser // handle to a valid account record char* Buffer // buffer to contain new data ) This function gets the mail directory for the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer to retrieve account data. Return values This function returns Buffer or '\0' if hUser does not point to a valid account. Remarks Buffer must be at least MAILDIR_LEN+1 chars long. Example char Buffer[MAILDIR_LEN+1]; MD_GetMailDir(hUser, Buffer); Back to API reference
void MD_SetMailDir( MD_HANDLE hUser // handle to a valid account record const char* Buffer // buffer containing new data ) This function sets the mail directory for the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer containing new account data. Return values none Remarks Care should be taken to ensure setting domain to Buffer will not cause a conflict with another account. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetMailDir(hUser, "C:\MDaemon\App\Altn\Arvel\"); Back to API reference
char* MD_GetPassword( MD_HANDLE hUser // handle to a valid account record char* Buffer // buffer to contain new data ) This function gets the password for the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer to retrieve account data. Return values This function returns Buffer or '\0' if hUser does not point to a valid account. Remarks Buffer must be at least PASSWORD_LEN+1 chars long. Example char Buffer[PASSWORD_LEN+1]; MD_GetPassword(hUser, Buffer); Back to API reference
void MD_SetPassword( MD_HANDLE hUser // handle to a valid account record const char* Buffer // buffer containing new data ) This function sets the password for the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer containing new account data. Return values none Remarks The password is encrypted and stored. If it is more than 15 characters long the password will be truncated. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetPassword(hUser, "ALTN"); Back to API reference
bool MD_GetWebConfigBit( MD_HANDLE hUser // handle to a valid account record int Bit // bit-mask specifying which bit to retrieve ) This function returns a specific WebConfig access right for an account. Parameters hUser - handle to a valid account record. Bit - bit-mask specifying which WebConfig access right is being queried. Valid values are: MDUSERDLL_ACCESSWORLDCLIENT - query the Access WorldClient right. MDUSERDLL_ACCESSWEBCONFIG - query the Access WebConfig right. MDUSERDLL_ISADMIN - query the Is Admin Level access right. MDUSERDLL_EDITFULLNAME - query the Edit Full Name right. MDUSERDLL_EDITPASSWORD - qeury the Edit Password right. MDUSERDLL_EDITMAILDIR - query the Edit Mail Directory right. MDUSERDLL_EDITFWD - query the Edit Forwarding Info right. MDUSERDLL_EDITADVFWD - query the Edit Advanced Forwarding right. MDUSERDLL_EDITEVERYONE - query the Edit Everyone right. MDUSERDLL_EDITMAILRESTRICTIONS - query the Edit Mail Restrictions right. MDUSERDLL_EDITQUOTAS - query the Edit Quotas right. MDUSERDLL_EDITMULTIPOP - query the toggle MultiPOP right. MDUSERDLL_EDITAUTORESPONDER - query the Edit Auto Responder right. MDUSERDLL_EDITIMAPRULES - query the Edit IMAP rules right. For details on what these specific rights mean consult the MDaemon manual in the section related to creating/editing accounts. Return values This function returns TRUE if the specified access bit is enabled. Otherwise if returns FALSE. Remarks This function should not normally be used by your application. Instead use one of the following predefined macros: MD_GetAccessWorldClient MD_GetAccessWebConfig MD_GetIsAdmin MD_GetEditFullName MD_GetEditPassword MD_GetEditMailDir MD_GetEditFwd MD_GetEditAdvFwd MD_GetEditEveryone MD_GetEditMailRestrictions MD_GetEditQuotas MD_GetEditMultiPOP MD_GetEditAutoResponder MD_GetEditIMAPRules Each of these macros calls MD_GetWebConfigBit with the appropriate bit-mask values. Example int hUser = MD_GetFirstUser(); if (MD_GetWebConfigBit(Index, MDUSERDLL_ACCESSWORLDCLIENT)) // do something useful if (MD_GetAccessWorldClient(hUser)) // do something useful Back to API reference
void MD_SetWebConfigBit( MD_HANDLE hUser // handle to a valid account record int Bit // bit-mask specifying which bit to set bool Value // value to set bit to ) This function sets a specific WebConfig access right for an account. Parameters hUser - handle to a valid account record. Bit - bit-mask specifying which WebConfig access right is being set. Valid values are: MDUSERDLL_ACCESSWORLDCLIENT - set the Access WorldClient right. MDUSERDLL_ACCESSWEBCONFIG - set the Access WebConfig right. MDUSERDLL_ISADMIN - set the Is Admin Level access right. MDUSERDLL_EDITFULLNAME - set the Edit Full Name right. MDUSERDLL_EDITPASSWORD - set the Edit Password right. MDUSERDLL_EDITMAILDIR - set the Edit Mail Directory right. MDUSERDLL_EDITFWD - set the Edit Forwarding Info right. MDUSERDLL_EDITADVFWD - set the Edit Advanced Forwarding right. MDUSERDLL_EDITEVERYONE - set the Edit Everyone right. MDUSERDLL_EDITMAILRESTRICTIONS - set the Edit Mail Restrictions right. MDUSERDLL_EDITQUOTAS - set the Edit Quotas right. MDUSERDLL_EDITMULTIPOP - set the toggle MultiPOP right. MDUSERDLL_EDITAUTORESPONDER - set the Edit Auto Responder right. MDUSERDLL_EDITIMAPRULES - set the Edit IMAP Rules right. For details on what these specific rights mean consult the MDaemon manual in the section related to creating/editing accounts. Return values none Remarks This function should not normally be used by your application. Instead use one of the following predefined macros: MD_SetAccessWorldClient MD_SetAccessWebConfig MD_SetIsAdmin MD_SetEditFullName MD_SetEditPassword MD_SetEditMailDir MD_SetEditFwd MD_SetEditAdvFwd MD_SetEditEveryone MD_SetEditMailRestrictions MD_SetEditQuotas MD_SetEditMultiPOP MD_SetEditAutoResponder MD_SetEditIMAPRules Each of these macros calls MD_SetWebConfigBit with the appropriate bit-mask values. Example MD_SetWebConfigBit(hUser, MDUSERDLL_ACCESSWORLDCLIENT, false); MD_SetAccessWorldClient(hUser, false); Back to API reference
bool MD_GetAutoDecode( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the auto decode flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to auto decode attachments. Otherwise it returns FALSE. Remarks none Example if (MD_GetAutoDecode(hUser)) // do something useful Back to API reference
void MD_SetAutoDecode( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the auto decode flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetAutoDecode(hUser, false); Back to API reference
bool MD_GetIsForwarding( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the forwarding flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to forward mail. Otherwise it returns FALSE. Remarks none Example if (MD_GetIsForwarding(hUser)) // do something useful Back to API reference
void MD_SetIsForwarding( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the forwarding flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks Be sure to also set a forwarding address using the MD_SetForwardingInfo function if you enable forwarding using this function. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetIsForwarding(hUser, false); Back to API reference
bool MD_GetAllowPOPAccess( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the allow POP access flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to allow POP access. Otherwise it returns FALSE. Remarks none Example if (MD_GetAllowPOPAccess(hUser)) // do something useful Back to API reference
bool MD_GetAllowIMAPAccess( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the allow IMAP access flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to allow IMAP access. Otherwise it returns FALSE. Remarks none Example if (MD_GetAllowIMAPAccess(hUser)) // do something useful Back to API reference
bool MD_GetAllowAccess( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the allow access flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to allow access. Otherwise it returns FALSE. Remarks This function was discontinued in MDaemon 8.12. Use MD_GetAllowPOPAccess and MD_GetAllowIMAPAccess instead. Example if (MD_GetAllowAccess(hUser)) // do something useful Back to API reference
void MD_SetAccessType( MD_HANDLE hUser // handle to a valid account record bool POP // allow POP access? bool IMAP // allow IMAP access? ) This function sets the state of the allow access flag for the account specified by hUser. Parameters hUser - handle to a valid account record. POP - buffer containing TRUE/FALSE whether POP access is allowed IMAP - buffer containing TRUE/FALSE whether IMAP access is allowed Return values none Remarks none Example MD_SetAccessType(hUser, true, true); // account can use both POP and IMAP Back to API reference
void MD_SetAllowAccess( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the allow access flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values This function was discontinued in MDaemon 8.12. Use MD_SetAccessType instead. Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetAllowAccess(hUser, true); Back to API reference
bool MD_GetAllowChangeViaEmail( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the allow change via email flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to allow changes via email. Otherwise it returns FALSE. Remarks none Example if (MD_GetAllowChangeViaEmail(hUser)) // do something useful Back to API reference
void MD_SetAllowChangeViaEmail( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the allow change via email flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetAllowChangeViaEmail(hUser, false); Back to API reference
bool MD_GetKeepForwardedMail( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the keep forwarded mail flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to keep copies of forwarded mail. Otherwise it returns FALSE. Remarks none Example if (MD_GetKeepForwardedMail(hUser)) // do something useful Back to API reference
void MD_SetKeepForwardedMail( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the keep forwarded mail flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetKeepForwardedMail(hUser, false); Back to API reference
bool MD_GetHideFromEveryone( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the hide from everyone flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to hide from the everyone lists. Otherwise it returns FALSE. Remarks none Example if (MD_GetHideFromEveryone(hUser)) // do something useful Back to API reference
void MD_SetHideFromEveryone( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the hide from everyone flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetHideFromEveryone(hUser, false); Back to API reference
bool MD_GetProcessCalendarRequests( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the calendar request flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to automatically process calendar requests found within incoming messages. Otherwise it returns FALSE. Remarks none Example if (MD_GetProcessCalendarRequests(hUser)) // do something useful Back to API reference
void MD_SetProcessCalendarRequests( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the calendar request processing flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetProcessCalendarRequests(hUser, false); Back to API reference
bool MD_GetDeclineConflictingRequests( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the decline conflicting requests flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to decline conflicting calendar requests when the option to automatically process calendar requests found within incoming messages is enabled. Otherwise it returns FALSE. Remarks none Example if (MD_GetProcessCalendarRequests(hUser) && MD_GetDeclineConflictingRequests(hUser)) // do something useful Back to API reference
void MD_SetDeclineConflictingRequests( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the decline conflicting requests flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetDeclineConflictingRequests(hUser, false); Back to API reference
bool MD_GetDeclineRecurringRequests( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the decline recurring requests flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set to decline recurring calendar requests when the option to automatically process calendar requests found within incoming messages is enabled. Otherwise it returns FALSE. Remarks none Example if (MD_GetProcessCalendarRequests(hUser) && MD_GetDeclineRecurringRequests(hUser)) // do something useful Back to API reference
void MD_SetDeclineRecurringRequests( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the decline recurring requests flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetProcessRecurringRequests(hUser, false); Back to API reference
bool MD_GetApplyQuotas( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the apply quotas flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is set subject to quota restrictions. Otherwise it returns FALSE. Remarks none Example if (MD_GetApplyQuotas(hUser)) // do something useful Back to API reference
void MD_SetApplyQuotas( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the apply quotas flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks If you call this function with a Value of TRUE you should also make certain that there are valid quota values by calling MD_SetMaxMessageCount and/or MD_SetMaxDiskSpace. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetApplyQuotas(hUser, false); Back to API reference
bool MD_GetEnableMultiPOP( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the enable MultiPOP flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if MultiPOP collection for the account is active. Otherwise it returns FALSE. Remarks none Example if (MD_GetEnableMultiPOP(hUser)) // do something useful Back to API reference
void MD_SetEnableMultiPOP( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the enable MultiPOP flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks This function only turns MultiPOP on or off. It does not configure individual MultiPOP account entries. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetEnableMultiPOP(hUser, false); Back to API reference
bool MD_GetCanModifyGAB( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the WorldClient global address book modification flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account can modify the WorldClient global address book. Otherwise it returns FALSE. Remarks none Example if (MD_GetCanModifyGAB(hUser)) // do something useful Back to API reference
Note: this function was deprecated in MD 15.60. Calling this function does nothing. It is left in place for backwards compatibility. void MD_SetCanModifyGAB( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the WorldClient global address book modification flag for the account specified by hUser. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetCanModifyGAB(hUser, false); Back to API reference
char* MD_GetMailFormat( MD_HANDLE hUser // handle to a valid account record char* Buffer // buffer which receives account info ) This function gets the name of the MBF file or the account specified by hUser. Parameters hUser - handle to a valid account record. Buffer - buffer to received account data. Return values This function returns Buffer. Remarks Buffer should be at least MAX_PATH+1 chars long. Example char MBF[MAX_PATH+1]; MD_GetMailFormat(hUser, MBF); Back to API reference
void MD_SetMailFormat( MD_HANDLE hUser // handle to a valid account record const char* Value // new value ) This function sets the MBF file the account is using to Value. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks This function sets the MBF file the account is using to Value. Value must be the name of an MBF file located within MDaemon's APP directory. The file must exist. Since 'RFC822.MBF' is the default mail format for all accounts calling this function with an argument of 'RFC822.MBF' is ignored. When specifying Value, specify only the file name - not a complete path. The file must be located in MDaemon's APP directory. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetMailFormat(hUser, "RFC822.MBF"); Back to API reference
long MD_GetMaxDiskSpace( MD_HANDLE hUser // handle to a valid account record ) This function gets the maximum disk space quota for an account. Parameters hUser - handle to a valid account record. Return values This function returns the maximum disk space quota (in KILOBYTES). Remarks none Example long Max = MD_GetMaxDiskSpace(hUser); // do something useful Back to API reference
void MD_SetMaxDiskSpace( MD_HANDLE hUser // handle to a valid account record long Value // new value ) This function sets the maximum disk space quota for an account. Parameters hUser - handle to a valid account record. Value - new maximum disk space quota (in KILOBYTES). Return values none Remarks Specify a value of 0 and there will be no limit to disk space usage. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetMaxDiskSpace(hUser, 500000); Back to API reference
long MD_GetMaxMessageCount( MD_HANDLE hUser // handle to a valid account record ) This function gets the maximum message count quota for an account. Parameters hUser - handle to a valid account record. Return values This function returns the maximum message count quota. Remarks none Example long Max = MD_GetMaxMessageCount(hUser); // do something useful Back to API reference
void MD_SetMaxMessageCount( MD_HANDLE hUser // handle to a valid account record long Value // new value ) This function sets the maximum message count quota for an account. Parameters hUser - handle to a valid account record. Value - new maximum message count quota. Return values none Remarks Specify a value of 0 and there will be no limit to the number of messages. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetMaxMessageCount(hUser, 500); Back to API reference
int MD_GetMultiPOPMaxMessageAge( MD_HANDLE hUser // handle to a valid account record ) This function gets the maximum number of days that mail will be left on MultiPOP servers being used by the account to collect mail. Parameters hUser - handle to a valid account record. Return values This function returns the maximum number of days that mail will be left on MultiPOP servers. Remarks When MultiPOP is configured to 'Leave messages on server', this is the number of days that mail will be left. After this many days, messages are deleted. A value of ZERO means that messages are left on the server indefinitely. Example long Max = MD_GetMultiPOPMaxMessageAge(Index); // do something useful Back to API reference
void MD_SetMultiPOPMaxMessageAge( MD_HANDLE hUser // handle to a valid account record int Value // new value ) This function sets the number of days to leave messages stored on MultiPOP servers. Parameters hUser - handle to a valid account record. Value - days to leave messages on MultiPOP servers. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetMultiPOPMaxMessageAge(hUser, 3); Back to API reference
long MD_GetMultiPOPMaxMessageSize( MD_HANDLE hUser // handle to a valid account record ) This function gets the maximum message size collectable with MultiPOP mail. Parameters hUser - handle to a valid account record. Return values This function returns the maximum size of a message which is collectable via MultiPOP (in KB). Remarks If a message exceeds this size the MultiPOP engine will not download it. Specify a value of 0 and there will be no limit to the size of a downloadable message. Example long Max = MD_GetMultiPOPMaxMessageSize(Index); // do something useful Back to API reference
void MD_SetMultiPOPMaxMessageSize( MD_HANDLE hUser // handle to a valid account record long Value // new value ) This function sets the maximum size of a message collectable via MultiPOP. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks This function uses a numerical representation of the maximum size setting. MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetMultiPOPMaxMessageSize(hUser, 500); Back to API reference
bool MD_RestrictInboundMail( const char* Email // valid account email address char* Action // buffer to receive restriction action char* AddressList // buffer to receive list of exceptions int Length // max length of AddressList ) This function retrieves all the settings related to inbound mail restrictions for an account. Parameters Email - the email address of a valid account. This function is different in that it does not use an account handle but will attempt to lock one using the Email address passed. Action - buffer to receive a character string which indicates what action should be taken should a restricted inbound message be encountered. Valid values are: 'Refused' - the message will be refused during the SMTP delivery process 'Returned to sender' - the message will be accepted and then returned to sender 'Sent to postmaster' - the message will be accepted and forwarded to the postmaster AddressList - double null terminated list of email addresses which itemize all the email addresses which are exceptions to all inbound mail restrictions. Length - the maximum length that AddressList can be. Return values This function returns TRUE if the account is configured to use inbound mail restrictions. Otherwise it returns FALSE. Remarks AddressList is a double null terminated list of strings which cannot exceed Length bytes. Each entry in AddressList is null terminated except the last one which is double null terminated. AddressList should be at least 5000 bytes. Example int Size = 5000; char AddressList[Size + 1]; char Action[128]; Action[0] = '\0'; if (MD_RestrictInboundMail("arvel@altn.com", Action, AddressList, Size)) { // the account is configured to use restrictions } Back to API reference
void MD_SetInboundMailRestrictions( const char* Email // valid account email address bool Restrict // should restrictions be observed? char* Action // action to take if restricted message is found char* AddressList // buffer to receive list of exceptions ) This function sets the inbound mail restrictions for an account. Parameters Email - the email address of a valid account. This function is different in that it does not use an account handle but will attempt to lock one using the Email address passed. Restrict - TRUE if restrictions should be observed, FALSE otherwise. Action - buffer to receive a character string which indicates what action should be taken should a restricted inbound message be encountered. Valid values are: 'Refused' - the message will be refused during the SMTP delivery process 'Returned to sender' - the message will be accepted and then returned to sender 'Sent to postmaster' - the message will be accepted and forwarded to the postmaster AddressList - double null terminated list of email addresses which itemize all the email addresses which are exceptions to all inbound mail restrictions. Return values None Remarks AddressList is expected to be a double null terminated list of email addresses. Example char AddressList[1000]; memset(AddressList, 0, 1000); memcpy(AddressList, "frank.thomas@hit-me-in.com\0mike@altn.com\0\0", 42); MD_SetInboundMailRestrictions("arvel@altn.com", TRUE, "Refused", AddressList); Back to API reference
bool MD_RestrictOutboundMail( const char* Email // valid account email address char* Action // buffer to receive restriction action char* AddressList // buffer to receive list of exceptions int Length // max length of AddressList ) This function retrieves all the settings related to outbound mail restrictions for an account. Parameters Email - the email address of a valid account. This function is different in that it does not use an account handle but will attempt to lock one using the Email address passed. Action - buffer to receive a character string which indicates what action should be taken should a restricted outbound message be encountered. Valid values are: 'Refused' - the message will be refused during the SMTP delivery process 'Returned to sender' - the message will be accepted and then returned to sender 'Sent to postmaster' - the message will be accepted and forwarded to the postmaster AddressList - double null terminated list of email addresses which itemize all the email addresses which are exceptions to all inbound mail restrictions. Length - the maximum length that AddressList can be. Return values This function returns TRUE if the account is configured to use outbound mail restrictions. Otherwise it returns FALSE. Remarks AddressList is a double null terminated list of strings which cannot exceed Length bytes. Each entry in AddressList is null terminated except the last one which is double null terminated. AddressList should be at least 5000 bytes. Example int Size = 5000; char AddressList[Size + 1]; char Action[128]; Action[0] = '\0'; if (MD_RestrictOutboundMail("arvel@altn.com", Action, AddressList, Size)) { // the account is configured to use restrictions } Back to API reference
void MD_SetOutboundMailRestrictions( const char* Email // valid account email address bool Restrict // should restrictions be observed? char* Action // action to take if restricted message is found char* AddressList // buffer to receive list of exceptions ) This function sets the outbound mail restrictions for an account. Parameters Email - the email address of a valid account. This function is different in that it does not use an account handle but will attempt to lock one using the Email address passed. Restrict - TRUE if restrictions should be observed, FALSE otherwise. Action - buffer to receive a character string which indicates what action should be taken should a restricted outbound message be encountered. Valid values are: 'Refused' - the message will be refused during the SMTP delivery process 'Returned to sender' - the message will be accepted and then returned to sender 'Sent to postmaster' - the message will be accepted and forwarded to the postmaster AddressList - double null terminated list of email addresses which itemize all the email addresses which are exceptions to all outbound mail restrictions. Return values None Remarks AddressList is expected to be a double null terminated list of email addresses. Example char AddressList[1000]; memset(AddressList, 0, 1000); memcpy(AddressList, "frank.thomas@hit-me-in.com\0mike@altn.com\0\0", 42); MD_SetOutboundMailRestrictions("arvel@altn.com", TRUE, "Refused", AddressList); Back to API reference
void MD_GetPruningFlags( MD_HANDLE hUser // handle to a valid account record int& MaxInactive // buffer to receive max inactivity int& MaxMessageAge // buffer to receive max message age int& MaxDeletedIMAPMessageAge // buffer to receive the maximum age for deleted IMAP messages bool& RecurseIMAP // buffer to receive IMAP pruning flag ) This function retrieves all the settings related to automatic pruning for an account. Parameters hUser - handle to a valid account record. MaxInactive - this will be set to the max number of inactive days before the account is automatically deleted. MaxMessageAge - this will be set to the max number of days old a message is allowed to be before it is automatically removed from the server. MaxDeletedIMAPMessage Age - this is the maximum age for deleted IMAP messages RecurseIMAP - this will be set to whether the IMAP folders are subject to old mail removal or not. Return values None Remarks This function retrieves the pruning flags for an account. If an account does not have any specific pruning flags then the default flags for the domain to which the account belongs will be returned in MaxInactive, MaxMessageAge, and RecurseIMAP. A value of ZERO for MaxInactive and MaxMessageAge indicates that there is no limitation on how long an account can be inactive and no limit to the age of messages in any mail folder. The MaxInactive and MaxMessageAge values are measured in days. Example int MaxInactive = 0; int MaxMessageAge = 0; int MaxDeletedIMAPMessageAge = 0; bool RecurseIMAP = false; MD_GetPruningFlags(MD_GetByEmail("arvel@altn.com"), MaxInactive, MaxMessageAge, MaxDeletedIMAPMessageAge, RecurseIMAP); Back to API reference
void MD_SetPruningFlags( MD_HANDLE hUser // handle to a valid account record int MaxInactive // max days of inactivity int MaxMessageAge // max age of messages int MaxDeletedIMAPMessageAge // maximum age for deleted IMAP messages bool RecurseIMAP // check IMAP folders for old messages bool UseDomainDefaults // set values to domain defaults ) This function sets the pruning flags for an account. Parameters hUser - handle to a valid account record. MaxInactive - contains the max number of inactive days before the account is automatically deleted. This parameter is ignored if UseDomainDefaults is TRUE. MaxMessageAge - contains the max number of days old a message is allowed to be before it is automatically removed from the server. This parameter is ignored if UseDomainDefaults is TRUE. MaxDeletedIMAPMessage Age - this is the maximum age for deleted IMAP messages RecurseIMAP - TRUE if IMAP folders should be checked for old messages. This parameter is ignored if UseDomainDefaults is TRUE. UseDomainDefaults - TRUE if the account's pruning flags should be set to the default values for the domain to which the account belongs. If TRUE then the MaxInactive, MaxMessageAge, and RecurseIMAP parameters are ignored. Return values none Remarks When the UseDomainDefaults is TRUE the account's pruning flags are set to the defaults for the domain the account is a part of and the MaxInactive, MaxMessageAge, and RecurseIMAP parameters are ignored. Example // Set flags to defaults for the 'altn.com' domain MD_SetPruningFlags(MD_GetByEmail("arvel@altn.com"), 0, 0, 0, false, true); // Set flags to specific values MD_SetPruningFlags(MD_GetByEmail("arvel@altn.com"), 10, 20, 5, true, false); Back to API reference
bool MD_GetUseDefaultPruning( MD_HANDLE hUser // handle to a valid account record ) This function returns whether the account is using the domain default pruning settings. Parameters hUser - handle to a valid account record. Return values This function returns TRUE if the account is setup to use the default pruning settings associated with the domain to which the account belongs. Otherwise it returns FALSE. Remarks none Example if (MD_GetUseDefaultPruning(MD_GetByEmail("arvel@altn.com")) // do something useful Back to API reference
void MD_SetUseDefaultPruning( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the account to use either it's own pruning settings or those of the domain to which the account belongs. Parameters hUser - handle to a valid account record. Value - buffer containing new account data. Return values none Remarks Calling this function with a Value of TRUE will reset the account's pruning flags to those of the domain to which the account belongs. Using FALSE will setup the account to use customized settings unique to the account in question. You can use MD_SetPruningFlags to set those specific values. Example MD_SetUseDefaultPruning(hUser, true); Back to API reference
void MD_GetAddrBookParms( MD_HANDLE hUser // handle to a valid account record bool& CheckAddrBook // boolean to receive check address book setting bool& UpdateAddrBook // boolean to receive update address book setting ) This function retrieves the address book settings for an account. Parameters hUser - handle to a valid account record. CheckAddrBook - this will be set to TRUE if the account is configured to use their personal address book file as a Spam Filter white list. UpdateAddrBook - this will be set to TRUE if the account is configured to have MDaemon automatically update the account's private address book file with the email address of whomever this account sends mail to. Return values None Remarks This function retrieves the address book flags for an account. MDaemon has a global toggle for each of these settings in the Spam Filter properties. Even when both CheckAddrBook and UpdateAddrBook are TRUE the actual functions they control will not take place if the global toggle is FALSE. This function retrieves the values configured for the account (whether TRUE or FALSE) and does not query the state of the global on/off switch mentioned above. Example bool CheckAddrBook = true; bool UpdateAddrBook = true; MD_GetAddrBookParms(MD_GetByEmail("arvel@altn.com"), CheckAddrBook, UpdateAddrBook); Back to API reference
void MD_SetAddrBookParms( MD_HANDLE hUser // handle to a valid account record bool CheckAddrBook // boolean containing check address book setting bool UpdateAddrBook // boolean containing update address book setting ) This function sets the address book settings for an account. Parameters hUser - handle to a valid account record. CheckAddrBook - contains a boolean which controls whether this account uses it's personal address book file as a spam Filter white list. UpdateAddrBook - contains a boolean which controls whether the account's personal address book file is automatically updated with the email addresses of those to whom this account sends email. Return values none Remarks none Example MD_SetAddrBookParms(MD_GetByEmail("arvel@altn.com"), TRUE, FALSE); Back to API reference
long MD_GetFileCount( MD_HANDLE hUser // handle to a valid account record ) This function retrieves the total number of message files located in an account's mailbox. Parameters hUser - handle to a valid account record. Return values This function returns the total number of message files located in the account's mailbox. Remarks All files within the mailbox are counted. If the following MDaemon.ini switch is set the file counting process will include all files in all sub-directories of the root mailbox: [Special] StrictQuotas=Yes (or No) If the following MDaemon.ini switch is set the file counting process will include hidden files: [Special] CountHiddenFiles=Yes (or No) Back to API reference
void MD_GetQuotaCounts( MD_HANDLE hUser // handle to a valid account record long& FileCount // buffer to receive file count long& KByteCount // buffer to receive disk space used ) This function retrieves the total number of files and kilobytes of disk storage currently being used by an account's mailbox. Parameters hUser - handle to a valid account record. FileCount - buffer to receive the number of files in the mailbox. KByteCount - buffer to receive the kilobytes of disk space used by mailbox. Return values None. Remarks All files within the mailbox are counted. If the following MDaemon.ini switch is set the file and byte counting process will include all files in all sub-directories of the root mailbox (possibly skipping non-mail folders and hidden files - see below): [Special] StrictQuotas=Yes (or No) If the following MDaemon.ini switch is set the file and byte counting process will include groupware (non-mail) folders: [Special] CountGroupwareFolders=Yes (or No) - requires StrictQuotas=Yes If the following MDaemon.ini switch is set the byte counting process will include hidden files: [Special] CountHiddenFiles=Yes (or No) Back to API reference
void MD_UpdateQuotaCounts( MD_HANDLE hUser // handle to a valid account record long FileCount // number of files to add long KByteCount // amount of disk space to add in kilobytes ) The number of files and amount of disk being used by a user is cached in QUOTACOUNTS.DAT. This function updates the cached values. Parameters hUser - handle to a valid account record. FileCount - number of files to add to cached value KByteCount - amount of disk consumed ot add to cached value Return values None. Remarks The number of files and amount of disk consumed by a user is cached in order to prevent the need for slow disk checks all the time. This function allows the cached counts to be updated without having to re-iterate across the disk. KByteCount is assumed to be a value in KB (kilobytes). Example To increment the cached file count by 1 file which is 100 KB in size call the function like this: MD_UpdateQuotaCounts(hUser, 1, 100); To zero out a users cached values (which will cause MDaemon to do a disk iteration the next time these values are needed) call the function passing 0 in the FileCount parm and -1 in the KByteCount parm: MD_UpdateQuotaCounts(hUser, 0, -1); Back to API reference
long MD_GetDirSize( MD_HANDLE hUser // handle to a valid account record ) This function retrieves the total number of kilobytes of disk storage currently being used by an account's mailbox. Parameters hUser - handle to a valid account record. Return values This function returns the total number of kilobytes of disk storage currently being used by an account's mailbox. Remarks All files within the mailbox are counted. If the following MDaemon.ini switch is set the byte counting process will include all files in all sub-directories of the root mailbox: [Special] StrictQuotas=Yes (or No) If the following MDaemon.ini switch is set the byte counting process will include hidden files: [Special] CountHiddenFiles=Yes (or No) Back to API reference
bool MD_IsDynamicPasswordStr( char* Password // pointer to buffer containing password ) This function tests Password to see if it is an NT dynamic password or not. Parameters Password - pointer to string buffer containing the password to test. Return values This function returns TRUE if Password is a dynamic NT authentication type. Remarks Dynamic passwords are those which contain two leading slash characters followed by the domain name of an NT domain. Example MD_UserInfo UserInfo; if (MD_IsDynamicPasswordStr(UserInfo.Password)) // do something useful Back to API reference
void MD_GetForwardingInfo( MD_HANDLE hUser // handle to a valid account record MD_Forwarding* Forwarding // pointer to MD_Forwarding struct ) This function retrieves all the forwarding address information for an account. Parameters hUser - handle to a valid account record. Address - buffer to receive the forwarding address. Host - buffer to receive the host to use when forwarding mail. SendAs - buffer to receive the HELO/EHLO value used when forwarding mail. Port - buffer to receive the port to use when forwarding mail. Return values none Remarks Address must be at least FWDADDR_LEN+1 chars long. Host must be at least FWDHOST_LEN+1 chars long. SendAs must be at least FWDSENDAS_LEN+1 chars long. Port must be at least PORT_LEN+1 chars long. If the account is using the advanced forwarding options then the Host, SendAs, and Port values will be filled with the advanced forwarding data. This information can be retrieved even if the account is not currently set to forward mail. For example, an account can be storing a forwarding address even thought they are not currently forwarding mail to it. To know if an account is actively forwarding mail use the MD_GetIsForwarding function. Example MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); if (MD_GetIsForwarding(hUser)) { char Address[FWDADDR_LEN+1]; char Host[FWDHOST_LEN+1]; char SendAs[FWDSENDAS_LEN+1]; char Port[PORT_LEN+1]; MD_GetForwardingInfo(hUser, Address, Host, SendAs, Port); } MD_GetFree(hUser); Back to API reference
bool MD_SetForwardingInfo( MD_HANDLE hUser // handle to a valid account record MD_Forwarding* Forwarding // pointer to MD_Forwarding struct ) This function sets all the forwarding address information for an account. Parameters hUser - handle to a valid account record. Address - buffer containing the forwarding address. Host - buffer containing the host to use when forwarding mail. SendAs - buffer containing the HELO/EHLO value used when forwarding mail. Port - buffer containing the port to use when forwarding mail. Return values This function returns TRUE if the forwarding information was able to be stored. Otherwise it returns FALSE. The reason for a FALSE return would be if Address, Host, SendAs, or Port exceeds their maximum length (see Remarks). Remarks Address cannot be greater than FWDADDR_LEN+1 chars long. Host cannot be greater than FWDHOST_LEN+1 chars long. SendAs cannot be greater than FWDSENDAS_LEN+1 chars long. Port cannot be greater than PORT_LEN+1 chars long. If the account is using the advanced forwarding options then the Host, SendAs, and Port values will be filled with the advanced forwarding data. Example MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); MD_SetForwardingInfo(hUser, "arvel@arvelh.com", "myisp.com", "altn.com", "25"); MD_GetFree(hUser); Back to API reference
void MD_GetAutoRespInfo( MD_HANDLE hUser // handle to a valid account record MD_AutoResponder* AutoResponder // pointer to MD_AutoResponder struct ) This function retrieves all the auto responder information for an account. Parameters hUser - handle to a valid account record. Script - complete path to the auto responder script file. Process - complete path to the program the auto responder will execute. AddToList - name of mailing list auto responder will join people to. RemoveFromList - name of mailing list auto responder will remove people from. Exclude - double null terminated list of address which are exempt from receiving the Script file. Return values none Remarks Script, Process, AddToList, and RemoveFromList must be at least MAX_PATH+1 chars long. Exclude must be at least AUTORESPEXCLUDE_LEN+1 bytes in length. Process can include the macro $MESSAGE$ which will be replaced with the path to the message file when the process is executed. Exclude will contain a NULL separated list of email address that are exempt from receiving the auto responder script file. In other words, messages from addresses found in Exclude will not trigger an auto response script. The end of this string will be double NULL terminated. For example, the resulting string might look like this: "arvel@altn.com\0arvel@arvel.altn.com\0arvel@arvelh.com\0\0" Example MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); if (hUser != MD_BADHANDLE) { char Script[MAX_PATH+1]; char Process[MAX_PATH+1]; char AddToList[MAX_PATH+1]; char RemoveFromList[MAX_PATH+1]; char Exclude[AUTORESPEXCLUDE_LEN+1]; bool PassMessageToProcess; MD_GetAutoRespInfo(hUser, Script, Process, AddToList, RemoveFromList, Exclude, PassMessageToProcess); } MD_GetFree(hUser); Back to API reference
bool MD_SetAutoRespInfo( MD_HANDLE hUser // handle to a valid account record MD_AutoResponder* AutoResponder // pointer to MD_AutoResponder struct ) This function sets all the auto responder information for an account. Parameters hUser - handle to a valid account record. Script - complete path to the auto responder script file. Process - complete path to the program the auto responder will execute. AddToList - name of mailing list auto responder will join people to. RemoveFromList - name of mailing list auto responder will remove people from. Exclude - double null terminated list of addresses which are exempt from receiving the Script file. Return values This function returns TRUE if the auto responder information was able to be stored. Otherwise it returns FALSE. Remarks Process can include the macro $MESSAGE$ which will be replaced with the path to the message file when the process is executed. Exclude must contain a NULL separated list of email address that are exempt from receiving the auto responder script file. In other words, messages from addresses found in Exclude will not trigger the return of an auto response script. The end of this string will be double NULL terminated. For example, the string might look like this: "arvel@altn.com\0arvel@arvel.altn.com\0arvel@arvelh.com\0\0" Example MD_HANDLE hUser = MD_GetByEmail("arvel@altn.com"); if (hUser != MD_BADHANDLE) { char Script[MAX_PATH+1]; strcpy(Script, "c:\\mdaemon\\app\\loconly.rsp"); char Process[MAX_PATH+1]; strcpy(Process, "c:\\mdaemon\\app\\dbimport.exe /a /b /i=$MESSAGE$"); char AddToList[MAX_PATH+1]; strcpy(AddToList, "add-list@altn.com") char RemoveFromList[MAX_PATH+1]; strcpy(RemoveFromList, "remove-list@altn.com"); char Exclude[AUTORESPEXCLUDE_LEN+1]; memset(Exclude, 0, AUTORESPEXCLUDE_LEN); char* ptr = &Exclude[0]; strcpy(ptr, "arvel@altn.com"); ptr += strlen(ptr); *ptr = '\0'; ptr++; strcpy(ptr, "arvel@arvelh.com"); ptr += strlen(ptr); *ptr = '\0'; bool PassMessageToProcess = true; MD_SetAutoRespInfo(hUser, Script, Process, AddToList, RemoveFromList, Exclude, PassMessageToProcess); MD_GetFree(hUser); } Back to API reference
bool MD_EraseAutoResp( MD_HANDLE hUser // handle to a valid account record ) This function erases the auto responder settings for an account. Parameters hUser - handle to a valid account record Return values This function returns TRUE if the auto responder information was erased. Otherwise it returns FALSE. Remarks None. Back to API reference ----------------------------------------- IMAP FOLDER AND RULE MANAGEMENT FUNCTIONS ----------------------------------------- The following functions allow you to create IMAP folders for accounts and manage the mail rules that move messages into those folders. A 'rule' is a set of criteria which decide which IMAP folder (if any) a message should be moved into. Rules are encapsulated in the following structure and use the following defines: #define HEADER_LEN 128 #define MATCHTEXT_LEN 128 struct MD_Rule { char Header[HEADER_LEN+1]; char MatchText[MATCHTEXT_LEN+1]; char Folder[MAX_PATH+1]; char Email[EMAIL_LEN+1]; // used when forwarding or redirecting messages int Relation; }; The Relation member can be one of these values: #define MDUSERDLL_ISEQUALTO 1 #define MDUSERDLL_ISNOTEQUALTO 2 #define MDUSERDLL_CONTAINS 3 #define MDUSERDLL_DOESNOTCONTAIN 4 #define MDUSERDLL_STARTSWITH 5 #define MDUSERDLL_ENDSWITH 6 #define MDUSERDLL_EXISTS 7 #define MDUSERDLL_DOESNOTEXIST 8 #define MDUSERDLL_ISGREATERTHAN 9 #define MDUSERDLL_ISLESSTHAN 10
MD_RULEHANDLE MD_FindFirstRule( MD_HANDLE hUser // handle to valid account MD_Rule* Rule // pointer to rule structure ) This function retrieves the first IMAP mail rule and places it in 'Rule'. Parameters hUser - handle to a valid user account Rule - pointer to MD_Rule structure to be filled in by this function. Return values The function returns a handle to the first rule in the accounts list of IMAP mail rules. If no rules are defined for an account or some other error occurs the function returns MD_BADRULEHANDLE. Remarks Use this function to begin iteration of all the existing IMAP mail rules for an account. The handle that is returned does not need to be explicitly freed with some other function call. The returned handle should be used in calls to MD_FindNextRule to iterate across the account's rule-set. Example MD_Rule Rule; MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_RULEHANDLE hRule = MD_FindFirstRule(hUser, &Rule); do { // Do something useful with Rule char Buf[256]; MD_RuleStructToRuleString(&Rule, Buf, 255); cout << Buf << endl; MD_RuleStringToRuleStruct(Buf, &Rule); cout << Rule.Header << endl << Rule.MatchText << endl; } while (MD_FindNextRule(hUser, hRule, &Rule)); Back to API reference
bool MD_FindNextRule( MD_HANDLE hUser // handle to valid account MD_RULEHANDLE* hRule // handle to previous rule MD_Rule* Rule // pointer to rule structure ) This function retrieves the next IMAP mail rule and places it in 'Rule'. Parameters hUser - handle to a valid user account hRule - handle to rule as allocated by MD_FindFirstRule Rule - pointer to MD_Rule structure to be filled in by this function. Return values This function returns TRUE if the next IMAP mail rule was read and placed in 'Rule.' If there are no more rules the function returns FALSE. Remarks Use this function to continue iteration of the existing IMAP mail rules for an account. hRule is the handle allocated by a call to MD_FindFirstRule. Example MD_Rule Rule; MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_RULEHANDLE hRule = MD_FindFirstRule(hUser, &Rule); do { // Do something useful with Rule char Buf[256]; MD_RuleStructToRuleString(&Rule, Buf, 255); cout << Buf << endl; MD_RuleStringToRuleStruct(Buf, &Rule); cout << Rule.Header << endl << Rule.MatchText << endl; } while (MD_FindNextRule(hUser, hRule, &Rule)); Back to API reference
bool MD_ReadRule( MD_HANDLE hUser // handle to valid account int Index // integer index to rule MD_Rule* Rule // structure filled in with rule details ) This function reads the specified rule from disk and places it in Rule. Parameters hUser - handle to a valid user account Index - integer index to the rule to read (starting at 0) Rule - MD_Rule structure to contain the rule data Return values This function returns TRUE if the rule was read. Otherwise it returns FALSE. Remarks This function is used internally by several other functions in the API to read rule data from disk and store it into the Rule structure provided. Although provided as an integer Index can be safely cast to MD_RULEHANDLE. Rules are stored in the users HIWATER.MRK file and indexed starting with 0. So, the first rule has an index of 0 and subsequent rules increment this by 1. Example MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_Rule Rule; int Index = 0; if (MD_ReadRule(hUser, Index, &Rule)) { strcpy(Rule.Folder, "DIFFERENT FOLDER"); MD_ChangeRule(hUser, (MD_RULEHANDLE)Index, &Rule); } Back to API reference
bool MD_RuleStructToRuleString( MD_Rule* Rule // handle to valid MD_Rule struct char* Buffer // buffer to receive the rule in string form int BufLen // max length of Buffer ) This function takes a rule in structure format and translates it into string format. Parameters Rule - MD_Rule structure which contains the rule information Buffer - character pointer to receive the rule in string format. BufLen - maximum number of characters Buffer can hold. Return values This function returns TRUE if the rule was translated into string form and stored in Buffer. Otherwise it returns FALSE. Remarks Use this function to transform a rule into string format for storage in a user's configuration file. When rules are stored in the account's HIWATER.MRK file they are stored in string format. Example MD_Rule Rule; MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_RULEHANDLE hRule = MD_FindFirstRule(hUser, &Rule); do { // Do something useful with Rule char Buf[256]; MD_RuleStructToRuleString(&Rule, Buf, 255); cout << Buf << endl; MD_RuleStringToRuleStruct(Buf, &Rule); cout << Rule.Header << endl << Rule.MatchText << endl; } while (MD_FindNextRule(hUser, hRule, &Rule)); Back to API reference
bool MD_RuleStringToRuleStruct( char* Buffer // rule in string format MD_Rule* Rule // structure to receive rule in struct format ) This function takes a rule in string format and translates it into structure format. Parameters Buffer - character pointer containing a rule in string format. Rule - MD_Rule structure which receives the rule in structure format. Return values This function returns TRUE if the rule was translated into structure form. Otherwise it returns FALSE. Remarks Use this function to transform a rule into structure format. Most of these API functions working with rules require it to be provided in structure format. Example MD_Rule Rule; MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_RULEHANDLE hRule = MD_FindFirstRule(hUser, &Rule); do { // Do something useful with Rule char Buf[256]; MD_RuleStructToRuleString(&Rule, Buf, 255); cout << Buf << endl; MD_RuleStringToRuleStruct(Buf, &Rule); cout << Rule.Header << endl << Rule.MatchText << endl; } while (MD_FindNextRule(hUser, hRule, &Rule)); Back to API reference
bool MD_DeleteRule( MD_HANDLE hUser // handle to valid account MD_RULEHANDLE hRule // handle to valid rule ) This function deletes a specific rule for an account. Parameters hUser - handle to a valid user account hRule - handle to a valid user account rule Return values This function returns TRUE if the rule was deleted. Otherwise it returns FALSE. Remarks Use this function to delete a specific rule within the context of a user account. Do not use this function within loops which depend on MD_FindFirstRule and MD_FindNextRule. Example int Index = 1; MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_DeleteRule(hUser, (MD_RULEHANDLE)Index); Back to API reference
bool MD_AddRule( MD_HANDLE hUser // handle to valid account MD_Rule* Rule // valid rule structure ) This function adds a rule to an account. Parameters hUser - handle to a valid user account Rule - valid MD_Rule structure filled in with rule information Return values This function returns TRUE if the rule was added. Otherwise it returns FALSE. Remarks Use this function to add a new rule within the context of a user account. The Rule structure must contain valid members and be constructed properly. Example MD_Rule Rule; strcpy(Rule->Folder, "MY FOLDER"); strcpy(Rule->Header, "SUBJECT"); strcpy(Rule->MatchText, "Match me"); Rule->Relation = MDUSERDLL_CONTAINS; MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_AddRule(hUser, &Rule); Back to API reference
bool MD_ChangeRule( MD_HANDLE hUser // handle to valid account MD_RULEHANDLE hRule // handle to valid rule MD_Rule* Rule // valid rule structure ) This function adds a rule to an account. Parameters hUser - handle to a valid user account hRule - handle to valid rule which will be changed Rule - valid MD_Rule structure filled in with rule information Return values This function returns TRUE if the rule was changed. Otherwise it returns FALSE. Remarks Use this function to change a rule within the context of a user account. The Rule structure must contain valid members and be constructed properly. The rule pointed to by hRule will be updated to the values specified in the Rule structure. Example MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_Rule Rule; int Index = 0; if (MD_ReadRule(hUser, Index, &Rule)) { strcpy(Rule.Folder, "DIFFERENT FOLDER"); MD_ChangeRule(hUser, (MD_RULEHANDLE)Index, &Rule); } Back to API reference
bool MD_MoveRuleUp( MD_HANDLE hUser // handle to valid account MD_RULEHANDLE hRule // handle to valid rule ) This function moves the specified rule up one position in the rule processing sequence. Parameters hUser - handle to a valid user account hRule - handle to valid rule which will be moved up Return values This function returns TRUE if the rule was moved up. Otherwise it returns FALSE. Remarks Rules are processed in sequence starting with the first rule and continuing until a match is found. Sometimes the sequence of rules are relevant to this process. You can move the specified rule up in the processing order by using this function. You should not use this function within loops which are iterating over all rules. Example MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_Rule Rule; int Index = 0; if (MD_ReadRule(hUser, Index, &Rule)) { MD_MoveRuleUp(hUser, (MD_USERHANDLE)Index); } Back to API reference
bool MD_MoveRuleDown( MD_HANDLE hUser // handle to valid account MD_RULEHANDLE hRule // handle to valid rule ) This function moves the specified rule down one position in the rule processing sequence. Parameters hUser - handle to a valid user account hRule - handle to valid rule which will be moved down Return values This function returns TRUE if the rule was moved down. Otherwise it returns FALSE. Remarks Rules are processed in sequence starting with the first rule and continuing until a match is found. Sometimes the sequence of rules are relevant to this process. You can move the specified rule down in the processing order by using this function. You should not use this function within loops which are iterating over all rules. Example MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_Rule Rule; int Index = 0; if (MD_ReadRule(hUser, Index, &Rule)) { MD_MoveRuleDown(hUser, (MD_USERHANDLE)Index); } Back to API reference This structure is used by API functions which manipulate MultiPOP information. struct MD_MultiPOPItem { char HostName[MDUSERDLL_MPHOSTNAME_LEN+1]; char UserName[MDUSERDLL_MPUSERNAME_LEN+1]; char Password[MDUSERDLL_MPPASSWORD_LEN+1]; int Flags; }; Fields HostName - the name of the host storing the MultiPOP mail UserName - the user name (logon name) of the account storing the MultiPOP mail Password - the password for the account storing the MultiPOP mail Flags - can be one or more of the following bit masks: MDUSERDLL_MPENABLED - this entry is enabled (active) MDUSERDLL_MPREMOVEMAIL - messages will be removed from Server after collected MDUSERDLL_MPUSEAPOP - APOP login will be used when c Remarks Functions which fill in MD_MultiPOPItem structures return the password in an unencrypted state. Functions which require MD_MultiPOPItem structures expect the password to be in an unencrypted state.
void MD_InitMultiPOPItem( MD_MultiPOPItem* Item // pointer to a MultiPOPItem structure ) This function initialized the members of Item. Parameters Item - pointer to a MultiPOPItem structure. Return values None Remarks This function initialized the string members of Item and sets Flags to MDUSERDLL_MPENABLED; Example MD_MultiPOP Item; MD_InitMultiPOPItem(&Item); Back to API reference
bool MD_AddMultiPOPItem( MD_HANDLE hUser // handle to valid account MD_MultiPOPItem* Item // pointer to a valid MultiPOPItem structure ) This function adds an entry to the MultiPOP database. Parameters hUser - handle to a valid user account Item - pointer to a valid MultiPOPItem structure previously filled in. Return values This function returns TRUE if Item was added to the MultiPOP database. Otherwise it returns FALSE. Remarks Use this function to add a new MultiPOP entry to the MultiPOP database file. MultiPOP hosts are checked by MDaemon on behalf of users and messages are pulled from them for local storage. Example MD_MultiPOP Item; MD_InitMultiPOPItem(&Item); strcpy(Item.HostName, "altn.com"); strcpy(Item.UserName, "Frank"); strcpy(Item.Password, "password"): Item.Flags = MDUSERDLL_MPENABLED | MPUSERDLL_USEAPOP; MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); MD_AddMultiPOPItem(MD_GetByEmail("user@domain.com"), &Item); Back to API reference
bool MD_DeleteMultiPOPItem( MD_HANDLE hUser // handle to valid account MD_MultiPOPItem* Item // pointer to a valid MultiPOPItem structure ) This function deletes an entry from the MultiPOP database Parameters hUser - handle to a valid user account Item - pointer to a valid MultiPOPItem structure previously filled in. Return values This function returns TRUE if Item was removed from the MultiPOP database. Otherwise it returns FALSE. Remarks Use this function to delete a MultiPOP entry from the MultiPOP database file. MultiPOP hosts are checked by MDaemon on behalf of users and messages are pulled from them for local storage. This function looks for a matching entry for hUser on Item.HostName with a logon of Item.UserName and removes it from the MultiPOP database. Only those two members of Item need be valid when passed to this function. Example MD_MultiPOP Item; MD_InitMultiPOPItem(&Item); strcpy(Item.HostName, "altn.com"); strcpy(Item.UserName, "Frank"); MD_DeleteMultiPOPItem(MD_GetByEmail("arvel@altn.com", &Item); Back to API reference
int MD_GetMultiPOPItems( MD_HANDLE hUser // handle to valid account MD_MultiPOPItem* Items // buffer to receive 1 or more MD_MultiPOPItem structures int Max // max number of MD_MultiPOPItem structures ) This function gets all the entries for a particular user from the MultiPOP database. Parameters hUser - handle to a valid user account Items - pointer to array of MD_MultiPOPItem structures Max - the max number of MD_MultiPOPItem structures that will fit into Items Return values This function returns the number of entries copied into Items. Remarks Use this function to retrieve all of the MultiPOP entries for a particular user. Passwords are returned in an unencrypted state. Example MD_MultiPOPItem* Items = new MD_MultiPOPItem[100]; int Count = MD_GetMultiPOPItems(MD_GetByEmail("arvel@altn.com"), &Items, 100)); for (int i = 0; i < Count; i++) { cout << Items[i].HostName << endl; } delete Items; Back to API reference
bool MD_SetMultiPOPItems( MD_HANDLE hUser // handle to valid account MD_MultiPOPItem* Items // buffer to receive 1 or more MD_MultiPOPItem structures int Count // the number of MD_MultiPOPItem structures to write ) This function writes entries for a particular user to the MultiPOP database. Parameters hUser - handle to a valid user account Items - pointer to array of MD_MultiPOPItem structures Count - the number of MD_MultiPOPItem structures contained within Items to write to disk Return values This function returns TRUE if Items were written to the MultiPOP database. Otherwise it returns FALSE. Remarks Use this function to set all of the MultiPOP entries for a particular user. Passwords within each entry must be unencrypted. This function will encrypt them before writing them to disk. This function first erases all existing entries for hUser before writing Count MD_MultiPOPItem structures from within Items to the MultiPOP database. Example MD_MultiPOPItem* Items = new MD_MultiPOPItem[100]; int Count = MD_GetMultiPOPItems(MD_GetByEmail("arvel@altn.com"), &Items, 100)); for (int i = 0; i < Count; i++) Items[i].Flags &= ~MDUSERDLL_MPENABLED; MD_SetMultiPOPItems(MD_GetByEmail("arvel@altn.com"), &Items, Count); delete Items; Back to API reference
bool MD_GetIMAPFolders( MD_HANDLE hUser // handle to valid account char* Buffer // buffer to contain folder names int BufLen // maximum length of Buffer ) This function returns the names of all user created IMAP folders for an account. Parameters hUser - handle to a valid user account Buffer - buffer which will received folder names BufLen - maximum number of characters Buffer can hold. Return values This function returns TRUE if the folders names were successfully read and placed in Buffer. Otherwise it returns FALSE. Remarks Buffer will contain a NULL separated list of all user created IMAP folders which exist for the accounts specified in hUser. The end of the string will be double NULL terminated. For example, the resulting string might look like this: "FOLDER1\0FOLDER1\SUBFOLDER1\0FOLDER2\0\0" To iterate across this string you can use code like this: char* ptr = Buffer; while (*ptr != '\0') { sprintf(Str, "Folder Name: %s", ptr); ptr += strlen(ptr)+1; } System generated IMAP folders such as DRAFTS and SENT ITEMS are not included in the folder list generated by this function. The actual location of the folder on disk can be obtained by prepending the account's root mail directory with the folder name and then appending ".IMAP". For example, if the folder is called "FOLDER1" and the account's root mail directory is "C:\MDAEMON\USERS\ARVEL\" then this IMAP folder's full path on disk would be "C:\MDAEMON\USERS\ARVEL\FOLDER1.IMAP". Note that the string returned from this function can contain embedded folders like this: "FOLDER1\SUB-FOLDER1". The actual path to this sub- folder would be "FOLDER1.IMAP\SUB-FOLDER1.IMAP". Example MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); char Buffer[256]; char MailDir[MAILDIR_LEN+1]; MD_GetMailDir(hUser, MailDir); MD_GetIMAPFolders(hUser, Buffer, 256); char* ptr = Buffer; while (*ptr != '\0') { char Str[256]; sprintf(Str, "Folder Name: %s", ptr); strcpy(Str, ptr); str::replace(Str, "\\", ".IMAP\\", 255); sprintf(FullFolderPath, "Full Folder Path: %s%s.IMAP", MailDir, Str); ptr += strlen(ptr)+1; } Back to API reference
bool MD_CreateIMAPFolder( MD_HANDLE hUser // handle to valid account char* Root // root IMAP folder char* Folder // new IMAP folder ) This function creates a new IMAP folder for an account. Parameters hUser - handle to a valid user account Root - root IMAP folder which will contain Folder Folder - new IMAP folder name Return values This function returns TRUE if the folder was created successfully. Otherwise it returns FALSE. Remarks The folder which is created will always be within the base mail directory for the account specified by hUser. Root is used when you wish to create an IMAP folder as a subfolder of another IMAP folder. When you wish to create an IMAP folder directly off the users mail directory you can specify NULL for the Root parameter. For example, suppose you wish to create a new IMAP folder called "FOLDER1". You can do so using this code: MD_CreateIMAPFolder(hUser, NULL, "FOLDER1"); Now suppose you wish to create a folder called "SUBFOLDER1" which should exist within the "FOLDER1" folder you just created. Do that with this sort of code: MD_CreateIMAPFolder(hUser, "FOLDER1", "SUBFOLDER1"); Also, you could directly specify the full path like this: MD_CreateIMAPFolder(hUser, NULL, "FOLDER1\SUBFOLDER1"); Example MD_HANDLE hUser = MD_GetByEmail("user@domain.com"); char* NewIMAPFolder[60]; char* RootIMAPFolder[60]; strcpy(RootIMAPFolder, "FOLDER1"); strcpy(NewIMAPFolder, "SUBFOLDER1"); MD_CreateIMAPFolder(hUser, RootIMAPFolder, NewIMAPFolder); Back to API reference
int MD_GetPublicIMAPFolderAccess( const char* FolderName // name of the public IMAP folder const char* Email // email address ) This function returns the access level what Email has within FolderName. Parameters FolderName - the name of the public IMAP folder Email - an email address Return values This function returns a bitmask representing the access level that Email has within FolderName. Value values can be a combination of the following: MDUSERDLL_IMAPNOACCESS - Email has no access to FolderName MDUSERDLL_IMAPREADACCESS - Email has read access to FolderName and may read all messages stored in the public folder. MDUSERDLL_IMAPWRITEACCESS - Email has write access to FolderName and may add messages to the public folder. MDUSERDLL_IMAPEXPUNGEACCESS - Email has expunge access to FolderName and may purge (remove) deleted messages from the public folder. MDUSERDLL_IMAPCREATEACCESS - Email has create access to FolderName and may both create and delete sub-folders within the public folder. Remarks At present this function always returns MDUSERDLL_IMAPREADACCESS when MDUSERDLL_IMAPWRITEACCESS is present. Similary both read and write access are implied when MDUSERDLL_IMAPEXPLUNGEACCESS is present. Finally, all access levels are implied when MDUSERDLL_IMAPCREATEACCESS is true. The function expects any public folder prefix string to be already removed from the start of the folder name. Example int Result = MD_GetPublicIMAPFolderAccess("My Public Folder", "arvel@altn.com"); if (Result & MDUSERDLL_IMAPREADACCESS) // "arvel@altn.com" can read messages stored in "My Public Folder" if (Result & MDUSERDLL_IMAPWRITEACCESS) // "arvel@altn.com" can add messages to "My Public Folder" Back to API reference
void MD_PublicIMAPFolderACLRemove( const char* Root // root public folder path const char* Email // email address ) This function is used to remove an email address from the public folder's Access Control List. Parameters Root - root public folder path Email - email address to remove from public folder's Access Control List Return values none Remarks If the Root parameter is NULL, the default root public folder path stored under Directories:PublicFolders in the MDaemon.ini will be used. Example MD_PublicFolderACLRemove("C:\\MDaemon\\Public Folders\\", "test@altn.com"); MD_PublicFolderACLRemove("", "test@altn.com"); // test@altn.com was removed from public folder's Acess Control List Back to API reference
void MD_PublicIMAPFolderACLUpdate( const char* Root // root public folder path const char* Old // existing email address const char* New // updated email address ) This function is used to update/rename an old email address with a new email address in the the public folder's Access Control List. Parameters Root - root public folder path Old - existing email address in the public folder's Access Control List New - email address to rename the old email address to in the public folder's Access Control List Return values none Remarks If the Root parameter is NULL, the default root public folder path stored under Directories:PublicFolders in the MDaemon.ini will be used. Example MD_PublicIMAPFolderACLUpdate("C:\\MDaemon\\Public Folders\\", "old@altn.com", "new@altn.com"); MD_PublicIMAPFolderACLUpdate("", "old@altn.com", "new@altn.com"); // old@altn.com was renamed to new@altn.com in the public folder's ACL Back to API reference --------------------------------- MAILING LIST MANAGEMENT FUNCTIONS --------------------------------- These functions allow management of mailing lists. Some of them require either the name of a valid mailing list or an MD_List structure. Where the name of a list is required this is the complete email address to the mailing list. For example 'mylist@mydomain.com'. struct MD_List { char ListName[MDLIST_MAXSIZE]; char ListIDText[MDLIST_MAXSIZE]; char ListDescription[MDLIST_MAXSIZE]; int ListFlags; int DigestFlags; int DefaultMode; int MaxMessageSize; int PrecedenceLevel; int RoutingLimit; int MaxMembers; int MaxMessageCount; int MaxLineCount; char ReplyAddress[MDLIST_MAXSIZE]; char RemoteHost[MDLIST_MAXSIZE]; char NotificationEmail[MDLIST_MAXSIZE]; char SendNotesTo[MDLIST_MAXSIZE]; char ModeratorEmail[MDLIST_MAXSIZE]; char ListPassword[MDLIST_MAXSIZE]; char WelcomeFilePath[MAX_PATH]; char KillFilePath[MAX_PATH]; char HeaderFilePath[MAX_PATH]; char FooterFilePath[MAX_PATH]; char CatalogName[MAX_PATH]; char DigestMBF[MAX_PATH]; char LastAccessTime[MDLIST_MAXSIZE]; char HelpURL[MDLIST_MAXURLSIZE]; char UnsubscribeURL[MDLIST_MAXURLSIZE]; char SubscribeURL[MDLIST_MAXURLSIZE]; char OwnerURL[MDLIST_MAXURLSIZE]; char ArchiveURL[MDLIST_MAXURLSIZE]; char PublicFolderName[PUBLICFOLDER_LEN]; MD_ODBC ODBC; MD_AD AD; char UserDefined[256]; bool CacheDirty; }; Fields ListName - the name (email address) of the mailing list ListIDText - text for List-ID header ListDescription - private text for admin use to describe list ListFlags - bit mapped field containing several list properties DigestFlags - bit mapped field containing several digest properties DefaultMode - default new member mode setting MaxMessageSize - largest size of an acceptable message (in KB) PrecedenceLevel - new message priority value RoutingLimit - number of RCPTs to send per message when routing posts to a smart host MaxMembers - the maximum number of members the list will allow MaxMessageCount - the max number of message received before a digest special edition is created MaxLineCount - the max number of lines of text received before a digest special edition is created ReplyAddress - the lists 'Reply-To:' email address RemoteHost - host name or IP of lists smart host NotificationEmail - email address which will receive list status and event notification emails SendNotesTo - email address which will receive sub/unsub notifications ModeratorEmail - email address of list moderator ListPassword - the lists password WelcomeFilePath - path to welcome file KillFilePath - path to suppression (kill) file HeaderFilePath - path to list header file FooterFilePath - path to list footer file CatalogName - path to catalog where digests are being stored DigestMBF - deprecated and no longer used LastAccessTime - date and time the last last processed a message HelpURL - text for List-Help header UnsubscribeURL - text for List-Unsubscribe header SubscribeURL - text for List-Subscribe header OwnerURL - text for List-Owner header ArchiveURL - text for List-Archive header PublicFolderName - the name of the public folder tied to this list ODBC - settings to query list members from an ODBC data source AD - settings to query list members from Active Directory UserDefined - unused CacheDirty - used by the MDaemon GUI's Mailing List Manager Remarks The ListFlags field is a bitmask which can contain one or more of the following bit flags: MDLIST_AUTOPRUNE - list is set to automatically remove bad addresses MDLIST_PRIVATE - list is flagged as private MDLIST_ALLOWEXPN - list responds to LISTS and EXPN requests MDLIST_LISTNAMEINSUBJECT - list puts list name in subject MDLIST_THREADNUMBINSUBJECT - list puts thread numbers in subject MDLIST_USEMEMBERNAMES - list uses member names in TO: header MDLIST_USELISTNAME - list uses list name in TO: header MDLIST_USESTANDARDNAME - list doesn't alter TO: header MDLIST_DENYDMARCREJECTERS - refuse messages from members who publish restrictive DMARC policy MDLIST_CRACKMESSAGE - list creates and spools individual message copies to all members MDLIST_FORCEUNIQUEID - list generates a unique Message-ID: header for each message copy MDLIST_IGNORERCPTERRORS - list ignores errors when spooling message to smart host MDLIST_MODERATED - list is moderated MDLIST_SUBSCRIBENOTE - list sends subscribe notifications MDLIST_UNSUBSCRIBENOTE - list sends unsubscribe notifications MDLIST_MSGTOOBIGNOTE - list sends 'message to big' notifications MDLIST_INFORMNONMEMBER - list informs non members that they can't post MDLIST_SENDSTATUSMESSAGES - list sends status messages MDLIST_ALLOWSUBSCRIBE - list allows people to subscribe MDLIST_AUTHSUBSCRIBE - list authentications subscription requests MDLIST_AUTHAUTOSUBSCRIBE - list authenticates subscriptions sent by autoresponders MDLIST_ALLOWUNSUBSCRIBE - list allows people to unsubscribe MDLIST_AUTHUNSUBSCRIBE - list authentications unsubscription requests MDLIST_AUTHAUTOUNSUBSCRIBE - list authenticates unsubscriptions sent by autoresponders MDLIST_PASSWORDPOST - list requires password to post a message MDLIST_USEPUBLICFOLDER - list is set to copy messages to a public folder MDLIST_HIDEFROMADDRESSBOOK - hide this list from the global address book MDLIST_ENABLED - list is enabled MDLIST_REWRITEFROMDMARC - replace 'From:' email address with list's email address if message is sent from a domain that publishes restrictive DMARC policy MDLIST_SENDREMINDERS - send monthly subscription reminders to all list members MDLIST_REPLYTOLIST - replace 'Reply-To' header email address with list's email address MDLIST_REPLYTOEMAIL - replace 'Reply-To' header email address with list's reply address The DigestFlags field is a bitmask which can contain one or more of the following bit flags: MDLIST_ENABLEDIGESTS - list generates digests MDLIST_FORCEDIGESTUSE - list forces all members to use digests MDLIST_ARCHIVEDIGESTS - list archives digest copies in a file catalog MDLIST_NINE - list spools digests to members at nine'o'clock MDLIST_TWELVE - list spools digests to members at twelve'o'clock MDLIST_THREE - list spools digests to members at three'o'clock MDLIST_SIX - list spools digests to members at six'o'clock MDLIST_AM - list spools digests to members in the AM hours MDLIST_PM - list spools digests to members in the PM hours The DefaultMode flags can be equal to one of the following: MDLIST_NORMAL - the member receives posts normally (as they arrive) MDLIST_POSTONLY - the member can only post to the list MDLIST_READONLY - the member can only read posts sent to the list MDLIST_DIGEST - the member receives posts in digest format Back to API reference This structure is used by API functions which require basic list member information. struct MD_ListMember { char ListName[128]; char Email[128]; char RealName[128]; }; Fields ListName - the name (email address) of the mailing list Email - a valid email address RealName - an optional real name to go with the Email address Back to API reference
void MD_InitListInfo( MD_List* List // Pointer to MD_List structure const char* ListName // Name of list ) This function initializes an MD_List structure Parameters List - Pointer to MD_List structure which will be initialized ListName - the mailing list address (ex: mylist@domain.com) Return values None Remarks This function initializes List to various default settings. It must be called prior to using an MD_List structure. ListName must be the complete email address of the mailing list (ex: mylist@mydomain.com). If the list does not exist it is created. If it does exist then the List member is initialized to the existing lists values. Example MD_List List; MD_InitListInfo(&List, "Mylist@mydomain.com"); Back to API reference
int MD_VerifyListInfo( MD_List* List // Pointer to MD_List structure ) This function verifies the content of the passed MD_List structure. Parameters List - Pointer to MD_List structure Return values This value returns one of the following values: MDLISTERR_NOERROR - no error found MDLISTERR_INVALIDLISTNAME - the List structure contains an invalid ListName member MDLISTERR_INVALIDEMAILADDRESS - the list structure contains an invalid email address (there are several possible members which require email addresses). MDLISTERR_INVALIDREMOTEHOST - the RemoteHost member is invalid Remarks This function verifies that the passed MD_List structure is configured with acceptable settings. It must be called prior to calling MD_WriteList(). Example MD_List List; MD_InitListInfo(&List, "Mylist@mydomain.com"); List->ListFlags |= MDLIST_PRIVATE; if (MD_VerifyListInfo(&List)) MD_WriteList(&List); Back to API reference
bool MD_WriteList( MD_List* List // Pointer to MD_List structure ) This function writes the list file to disk. After calling this function you need to also call MD_ClearListSettingsCache Parameters List - Pointer to MD_List structure Return values This function returns TRUE if the list settings were written to disk. Otherwise it returns FALSE. Example MD_List List; MD_InitListInfo(&List, "Mylist@mydomain.com"); List->ListFlags |= MDLIST_PRIVATE; if (MD_VerifyListInfo(&List)) MD_WriteList(&List); MD_ClearListSettingsCache("Mylist@mydomain.com"); Back to API reference
bool MD_DeleteList( const char* ListName // Name of list to delete ) This function deletes a mailing list. After calling this function you need to also call MD_ClearListSettingsCache Parameters ListName - name (email address) of the mailing list to delete Return values None Remarks The list file is completely deleted from disk. Use with care. Example MD_DeleteList("Mylist@mydomain.com"); MD_ClearListSettingsCache("Mylist@mydomain.com"); Back to API reference
void MD_ClearListSettingsCache( const char* ListName // Address of list to to clear from the settings cache or NULL to clear all lists from cache ) This function clears the list cache for a specific list or for all lists by passing NULL instead of a listname Parameters ListName - Address of the mailing list to clear from the cache Return Values None Remarks You must call this function after createing or deleting a mailing list for other programs using the DLL to see the changes Back to API reference
bool MD_ListPrivate( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is private and only list members can post. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListPrivate("mylist@mydomain.com")) // flag is set else // flag is not set
Back to API reference bool MD_ListSyncWithPublicFolder( const char* ListName // The email address of the mailing list char* FolderName // Public folder name char* AccessLevel // Access level string ) This function returns information related to the list's public folder settings. Parameters ListName- name (email address) of the mailing list FolderName - buffer which will receive the name of the public folder this list is copying messages into AccessLevel - buffer which will receive a string representation of the access level given to new list members when they are automatically added to the public folder's access list Return values This function returns TRUE if the list is configured to use a public folder. Otherwise it returns FALSE and FolderName and AccessLevel are blanked. Remarks FolderName and AccessLevel must be at least 256 bytes in length. AccessLevel will be one of the following strings: "No access" "Read" "Read/Write" "Read/Write/Expunge" "Read/Write/Expunge/Create" For a description of what these strings mean see MD_GetPublicIMAPFolderAccess. Example char FolderName[256]; char AccessLevel[256]; if (MD_ListSyncWithPublicFolder("TestList@altn.com", FolderName, AccessLevel)) { // do something useful } Back to API reference
bool MD_ListAllowExpn( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list responds to EXPN and LISTS commands providing membership information. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListAllowExpn("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListCrackMessage( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to create individual message copies for each member when a new post is processed. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListCrackMessage("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListRouteMessage( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to route a single copy of the message file to a smart host for cracking. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListRouteMessage("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListUseMemberNames( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to use member names in the TO: header when creating individual copies of incoming posts. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListUseMemberNames("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListUseListName( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to use the name of the mailing list in the TO: header when creating individual copies of incoming posts. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListUseListName("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListInsertCaption( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to insert the name of the list in the TO: header when creating individual copies of incoming posts. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListInsertCaption("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListForceUniqueID( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to create and insert a unique Message-ID value in each copy created from an incoming post. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListForceUniqueID("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListPasswordPost( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to require a password when processing certain list posts. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListPasswordPost("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListIgnoreRcptErrors( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to ignore errors encountered when sending multiple RCPT commands to a smart host. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListIgnoreRcptErrors("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListNameInSubject( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to insert the name of the list in the SUBJECT: header when creating individual copies of incoming posts. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListNameInSubject("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListThreadNumbInSubject( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to insert a message thread number in the SUBJECT: header when creating individual copies of incoming posts. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListThreadNumbInSubject("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListAuthSubscribe( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to authenticate subscription requests. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListAuthSubscribe("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListAuthAutoSubscribe( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to authenticate subscriptions generated by an autoresponder. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListAuthAutoSubscribe("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListAuthUnsubscribe( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to authenticate unsubscription requests. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListAuthUnsubscribe("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListAuthAutoUnsubscribe( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to authenticate unsubscriptions generated by an autoresponder. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListAuthAutoUnsubscribe("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListEnableDigest( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to create and use digests. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListEnableDigest("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListForceDigestUse( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to force all users to receive posts in digest format. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListForceDigestUse("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListAM( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to spool digests in the AM hours Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListAM("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListPM( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to spool digests in the PM hours Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListPM("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListArchiveDigest( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to archive digests to a catalog. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListArchiveDigest("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListInformNonMember( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to inform non members that their list posts will not be accepted. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListInformNonMember("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListSendStatusMessages( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to send notification messages when users subscribe/unsubscribe. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListSendStatusMessages("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListAutoPrune( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to automatically remove list members when messages fail to be delivered to them properly. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListAutoPrune("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListUsePublicFolder( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to copy list messages into a public folder. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListUsePublicFolder("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListAllowUnsubscribe( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to process unsubscription requests. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListAllowUnsubscribe("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListAllowSubscribe( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns TRUE if the list is configured to process subscription requests. Otherwise it returns FALSE. Example if (MD_ListAllowSubscribe("mylist@mydomain.com")) // flag is set else // flag is not set Back to API reference
bool MD_ListSendSubAuth( const MD_ListMember* Info // Pointer to an MD_ListMember structure bool ForceSend // Flag to force sending subscription auth message ) This function sends a list subscription authorization request to an email address. Parameters Info - pointer to an MD_ListMember structure. This must be filled in prior to calling this function. ForceSend - flag that controls sending of the auth request message (see below) Return values This function returns TRUE if the authorization request was sent. Otherwise it returns FALSE. Remarks This function sends a list authorization request email to a recipient. If the email is responded to within a certain time period as defined elsewhere in the list properties then the address specified in Info is added to the mailing list. Some lists are configured to NOT use authorization requests. To be certain that authorization requests are sent to such lists you must set the ForceSend parameter to TRUE. This function returns FALSE if the list specified in Info does not exist. This function returns FALSE if the list specified in Info does not require authorization requests and the ForceSend parameter is FALSE. Example MD_ListMember Info; strcpy(Info.ListName, "MyList@domain.com"); strcpy(Info.Email, "frank@domain.com"); strcpy(Info.RealName, "Frank Thomas"); if (MD_ListSendSubAuth(&Info, true)) // the auth request was sent else // the auth request was not sent Back to API reference
bool MD_ListSendUnSubAuth( const MD_ListMember* Info // Pointer to an MD_ListMember structure bool ForceSend // Flag to force sending subscription auth message ) This function sends a list unsubscription authorization request to an email address. Parameters Info - pointer to an MD_ListMember structure. This must be filled in prior to calling this function. ForceSend - flag that controls sending of the auth request message (see below) Return values This function returns TRUE if the authorization request was sent. Otherwise it returns FALSE. Remarks This function sends a list authorization request email to a recipient. If the email is responded to within a certain time period as defined elsewhere in the list properties then the address specified in Info is removed from the mailing list. Some lists are configured to NOT use authorization requests. To be certain that authorization requests are sent to such lists you must set the ForceSend parameter to TRUE. This function returns FALSE if the list specified in Info does not exist or if the email address specified in Info is not a current list member. This function returns FALSE if the list specified in Info does not require authorization requests and the ForceSend parameter is FALSE. Example MD_ListMember Info; strcpy(Info.ListName, "MyList@domain.com"); strcpy(Info.Email, "frank@domain.com"); strcpy(Info.RealName, "Frank Thomas"); if (MD_ListSendUnSubAuth(&Info, true)) // the auth request was sent else // the auth request was not sent Back to API reference
long MD_ListMaxMessageSize( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns the maximum message size acceptable to the list. Messages larger than this size will not be accepted by the list. Remarks This function is actually a macro which calls MD_GetListLongKey. Example long Result = MD_ListMaxMessageSize("mylist@mydomain.com"); if (Result > SomeValue) // do something else // do something else Back to API reference
long MD_ListMaxMembers( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns the maximum number of members the list can have. Remarks This function is actually a macro which calls MD_GetListLongKey. Example long lMaxMembers = MD_ListMaxMembers("mylist@mydomain.com"); Back to API reference
long MD_ListRoutingLimit( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns the maximum number of members to spool per post when routing messages to a smart host. Remarks This function is actually a macro which calls MD_GetListLongKey. Example long Result = MD_ListRoutingLimit("mylist@mydomain.com"); if (Result > SomeValue) // do something else // do something else Back to API reference
long MD_ListMaxMessageCount( const char* ListName // The email address of the mailing list ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns the maximum number of messages added to a digest before the digest is automatically spooled as a 'special edition'. Remarks This function is actually a macro which calls MD_GetListLongKey. Example long Result = MD_ListMaxMessageCount("mylist@mydomain.com"); if (Result > SomeValue) // do something else // do something else Back to API reference
long MD_ListMaxLineCount( const char* ListName // The email address of the mailing list ) This function was deprecated in MD 16.50 and now always returns ZERO. Back to API reference
bool MD_ListReplyAddress( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive the list reply address ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive the list reply address Return values This function returns TRUE if the list contains a reply address key (even if that key has no value). otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListStringKey. Buffer must be at least 256 bytes in size. Example char Buffer[256]; if (MD_ListReplyAddress("mylist@mydomain.com", Buffer)) { if (Buffer[0] != '\0') // do something with Buffer } Back to API reference
bool MD_ListPublicFolderName( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive the public folder name ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive the public folder name the list is using Return values This function returns TRUE if the list has a public folder associated with it. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListStringKey. Buffer must be at least PUBLICFOLDER_LEN + 1 bytes in size. Note: you should call MD_ListUsePublicFolder to verify that the list is actually configured to use the public folder returned by this function (the feature could be inactive and this function still return TRUE). Example char Buffer[PUBLICFOLDER_LEN+1]; if (MD_ListPublicFolderName("mylist@mydomain.com", Buffer)) { if (Buffer[0] != '\0') // do something with Buffer } Back to API reference
void MD_ListNotificationAddress( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive the notification address ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive the list notification address Return values None Remarks If the list has a notification address configured to receive various list status and event messages it will be returned in Buffer. Otherwise Buffer will be equal to the string '[trash]' which specifically means that the list will not generated such messages. Example char Buffer[256]; MD_ListNotificationAddress("mylist@mydomain.com", Buffer); if (strcmpi(Buffer, "[trash]") == 0) // do something else // do something else Back to API reference
bool MD_ListRemoteHost( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive the smart host ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive the smart host name or IP Return values This function returns TRUE if the list contains a remote host key (even if that key has no value). otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListStringKey. Buffer must be at least 256 bytes in size. Upon success Buffer will contain either the name or IP address of the smart host which the list is routing posts to. Example char Buffer[256]; if (MD_ListRemoteHost("mylist@mydomain.com", Buffer)) { if (Buffer[0] != '\0') // do something with Buffer } Back to API reference
bool MD_ListWelcomeFile( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive path to welcome file ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive path to welcome file Return values This function returns TRUE if the list if configured to use a welcome file and that file exists. otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListStringKey. Buffer must be at least 256 bytes in size. Upon success Buffer will contain the complete path to the list's welcome file and that file will be present on disk. Example char Buffer[256]; if (MD_ListWelcomeFile("mylist@mydomain.com", Buffer)) { if (Buffer[0] != '\0') // do something with Buffer } Back to API reference
bool MD_ListKillFile( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive path to kill file ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive path to kill file Return values This function returns TRUE if the list if configured to use a kill file and that file exists. otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListStringKey. Buffer must be at least 256 bytes in size. Upon success Buffer will contain the complete path to the list's suppression or kill file and that file will be present on disk. Example char Buffer[256]; if (MD_ListKillFile("mylist@mydomain.com", Buffer)) { if (Buffer[0] != '\0') // do something with Buffer } Back to API reference
bool MD_ListApplyHeader( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive path to header file ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive path to header file Return values This function returns TRUE if the list if configured to use a header file and that file exists. otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListStringKey. Buffer must be at least 256 bytes in size. Upon success Buffer will contain the complete path to the list's header file and that file will be present on disk. Example char Buffer[256]; if (MD_ListHeaderFile("mylist@mydomain.com", Buffer)) { if (Buffer[0] != '\0') // do something with Buffer } Back to API reference
bool MD_ListApplyFooter( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive path to footer file ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive path to footer file Return values This function returns TRUE if the list if configured to use a footer file and that file exists. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListStringKey. Buffer must be at least 256 bytes in size. Upon success Buffer will contain the complete path to the list's footer file and that file will be present on disk. Example char Buffer[256]; if (MD_ListApplyFooter("mylist@mydomain.com", Buffer)) { if (Buffer[0] != '\0') // do something with Buffer } Back to API reference
void MD_ListDefaultMode( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive string value ) This function returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive string representation of default list mode Return values None Remarks This function retrieves the string representation of the default list mode which will be assigned to new list members. Possible values are the strings 'Normal', 'Post only', 'Read only', or 'Digest'. Example char DefaultMode[20]; MD_ListDefaultMode("mylist@mydomain.com", DefaultMode); cout << "The default list mode is: " << DefaultMode << endl; Back to API reference
bool MD_ListAddMember( const char* ListName // The email address of the mailing list const char* Email // New list member email address const char* RealName // New list member real name int Mode // New list member access mode bool SendWelcome // Send welcome file to new member? ) This function adds a member to a mailing list. Parameters ListName - the mailing list address (ex: mylist@domain.com) Email - email address which will be added to list membership RealName - real name of the user to be added (optional) Mode - must be one of the following values: MDLIST_NORMAL - the member receives posts normally (as they arrive) MDLIST_POSTONLY - the member can only post to the list MDLIST_READONLY - the member can only read posts sent to the list MDLIST_DIGEST - the member receives posts in digest format SendWelcome - TRUE is the user should be sent the list welcome file, FALSE otherwise. Return values This function returns TRUE if the email address was added. Otherwise it returns FALSE. Remarks This function returns false if the email address is already a member of the list or is otherwise illegal is some way. If the address is on the lists suppression file the function will return FALSE. Example if (MD_ListAddMember("mylist@mydomain.com", "arvel@altn.com", "Arvel Hathcock", MDLIST_NORMAL, TRUE)) { // the member was successfully added to the list membership } Back to API reference
bool MD_ListWriteMember( MD_ListMember* Member // List member structure bool SendWelcome // Send welcome file to new member? ) This function adds a member to a mailing list. Parameters Member - MD_ListMember structure containing list member data SendWelcome - TRUE is the user should be sent the list welcome file, FALSE otherwise. Return values This function returns TRUE if the email address was added. Otherwise it returns FALSE. Remarks This function returns false if the email address is already a member of the list or is otherwise illegal is some way. If the address is on the lists suppression file the function will return FALSE. Example MD_ListMember pMember; strcpy(pMember.ListName, "TestList@altn.com"); strcpy(pMember.Email, "arvel@altn.com"); strcpy(pMember.RealName, "Arvel Hathcock"); pMember.Type = MDLIST_NORMAL; if (MD_ListWriteMember(&pMember, TRUE)) { // the member was successfully added to the list membership } Back to API reference
bool MD_ListSetRealName( const char* ListName // The email address of the mailing list const char* Email // List member email address const char* RealName // New real name value ) This function changes an existing list members real name value. Parameters ListName - the mailing list address (ex: mylist@domain.com) Email - email address of an existing list member RealName - new real name value Return values This function returns TRUE if the real name value was updated. Otherwise it returns FALSE. Remarks This function returns FALSE if Email is not a member of the list or if some error occured while trying to change the real name value. Example if (MD_ListSetRealName("mylist@mydomain.com", "arvel@altn.com", "Arvel Hathcock")) cout << "Real name for member arvel@altn.com changed to Arvel Hathcock" << endl; Back to API reference
bool MD_ListSetDigest( const char* ListName // The email address of the mailing list const char* Email // List member email address bool Mode // New digest value ) This function changes an existing list members digest mode flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Email - email address of an existing list member Mode - new digest mode Return values This function returns TRUE if the members digest mode was updated. Otherwise it returns FALSE. Remarks This function returns FALSE if Email is not a member of the list. The members digest mode is changed. If Mode is TRUE then list traffic will be sent to the member in digest format. Example if (MD_ListSetDigest("mylist@mydomain.com", "arvel@altn.com", TRUE)) // member will receive posts in digest form Back to API reference
bool MD_ListSetNomail( const char* ListName // The email address of the mailing list const char* Email // List member email address bool Mode // New Nomail value ) This function changes an existing list members nomail mode flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Email - email address of an existing list member Mode - new nomail mode Return values This function returns TRUE if the members nomail mode was updated. Otherwise it returns FALSE. Remarks This function returns FALSE if Email is not a member of the list. The members nomail mode is changed. If Mode is TRUE then no list traffic will be sent to the member but his address will remain part of the list. Example if (MD_ListSetNomail("mylist@mydomain.com", "arvel@altn.com", TRUE)) // member will not receive list messages Back to API reference
bool MD_ListSuppressed( const char* ListName // The email address of the mailing list const char* Email // Email address ) Parameters ListName - the mailing list address (ex: mylist@domain.com) Email - email address Return values This function returns TRUE if Email is a member of the lists suppression file. Otherwise it returns FALSE. Remarks Email addressed listed in the lists suppression file can not send messages to the mailing list. Example if (MD_ListSuppressed("mylist@mydomain.com", "arvel@altn.com")) // 'arvel@altn.com' is a member of the lists suppression file Back to API reference
bool MD_ListIsMember( const char* ListName // The email address of the mailing list const char* Email // Email address bool& ReadOnly // bool value to receive read only status bool CheckAdmins // should global admins be considered members? ) This function checks if an email address is a list member or not. Parameters ListName - the mailing list address (ex: mylist@domain.com) Email - email address ReadOnly - bool value to receive read only status CheckAdmins - bool value telling function whether to consider global admins members Return values This function returns TRUE if Email is a member of the list or if Email is a Global Administrator and CheckAdmins is TRUE. Otherwise it returns false. Remarks The ReadOnly parameter will be set by this function to TRUE if Email is a member and is flagged for 'Read only' access to the list. If CheckAdmins is TRUE then this function returns TRUE if Email is a Global Administrator even if Email is not actually a member of the list. This is used by MDaemon to allow Global Admins to always have access to the list even when not a member. Example if (MD_ListIsMember("mylist@mydomain.com", "arvel@altn.com")) // 'arvel@altn.com' is a member of 'mylist@mydomain.com' Back to API reference
bool MD_ListRemoveMember( const char* ListName // The email address of the mailing list const char* Email // email address to remove from list ) This function removes a member from a mailing list. Parameters ListName - the mailing list address (ex: mylist@domain.com) Email - email address to remove from list Return values This function returns TRUE if the email address was removed. Otherwise it returns FALSE. Remarks This function returns false if the email address is not a member of the list or is otherwise illegal is some way. Example if (MD_ListRemoveMember("mylist@mydomain.com", "arvel@altn.com")) // 'arvel@altn.com' was removed Back to API reference
void MD_ListRemoveFromAll( const char* Email // email address to remove from all lists ) This function removes a member from all mailing lists. Parameters Email - email address to remove from all mailing lists Return values None Example MD_ListRemoveFromAll("arvel@altn.com"); Back to API reference
int MD_ListMemberCount( const char* ListName // The email address of the mailing list ) This function returns the current membership count. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns the number of current list members. Example int MemberCount = MD_ListMemberCount("mylist@mydomain.com"); Back to API reference
int MD_ListPrecedenceLevel( const char* ListName // The email address of the mailing list ) This function returns the current list precedence value. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns the current list precedence value. This is the value placed on list posts (such as MD_PRECENDENCE_BULK which is the default). Example int Value = MD_ListPrecedenceLevel("mylist@mydomain.com"); Back to API reference
bool MD_ListSubscribeNote( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive an email address ) This function returns the email address which will receive subscription notifications. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive an email address Return values This function returns TRUE if the list is configured to send subscription notifications to a certain address (which will be put in Buffer). Otherwise it returns FALSE. Remarks Buffer will receive the email address which the list is sending subscribe notifications to. Example char Buffer[256]; if (MD_ListSubscribeNote("mylist@mydomain.com", Buffer)) // subscription notifications will be sent to Buffer Back to API reference
bool MD_ListUnsubscribeNote( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive an email address ) This function returns the email address which will receive unsubscription notifications. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive an email address Return values This function returns TRUE if the list is configured to send unsubscription notifications to a certain address (which will be put in Buffer). Otherwise it returns FALSE. Remarks Buffer will receive the email address which the list is sending unsubscribe notifications to. Example char Buffer[256]; if (MD_ListUnsubscribeNote("mylist@mydomain.com", Buffer)) // unsubscription notifications will be sent to Buffer Back to API reference
bool MD_ListMsgTooBigNote( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive an email address ) This function returns the email address which will receive 'message too big' notifications. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive an email address Return values This function returns TRUE if the list is configured to send 'message too big' notifications to a certain address (which will be put in Buffer). Otherwise it returns FALSE. Remarks Buffer will receive the email address which the list is sending 'message too big' notifications to. Example char Buffer[256]; if (MD_ListMsgTooBigNote("mylist@mydomain.com", Buffer)) // notifications will be sent to Buffer Back to API reference
bool MD_ListPassword( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive list password ) This function returns the list password. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive password Return values This function returns TRUE if the list is configured to use a password (which will be put in Buffer). Otherwise it returns FALSE. Remarks Buffer will receive the list password. Example char Buffer[256]; if (MD_ListPassword("mylist@mydomain.com", Buffer)) // Buffer will contain the list password Back to API reference
bool MD_ListArchiveCatalog( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive catalog name ) This function returns the name of the digest catalog. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive name of digest catalog Return values This function returns TRUE if the list is configured to store digest copies in a file catalog and that catalog exists. The name of the catalog itself will be placed in Buffer. Otherwise it returns FALSE. Remarks Buffer will receive the name of the catalog configured to store digest copies. Example char Buffer[256]; if (MD_ListArchiveCatalog("mylist@mydomain.com", Buffer)) // Buffer will contain the name of the catalog Back to API reference
bool MD_ListDigestMBF( const char* ListName // The email address of the mailing list char* Buffer // Buffer to receive digest MBF name ) This function returns the name of the digest MBF file. Parameters ListName - the mailing list address (ex: mylist@domain.com) Buffer - buffer to receive name of the digest MBF file Return values This function returns TRUE if the list is MBF file exists. Otherwise it returns FALSE. Example char Buffer[256]; if (MD_ListDigestMBF("mylist@mydomain.com", Buffer)) // Buffer will contain the name of the digest MBF Back to API reference
bool MD_ListModerated( const char* ListName // The email address of the mailing list char* Email // Buffer to receive moderators email address char* Password // Buffer to receive list password bool& PasswordPost // Bool to receive password post flag ) This function returns the email address of the moderator and also the lists password settings. Parameters ListName - the mailing list address (ex: mylist@domain.com) Email - buffer to receive moderators email address Password - buffer to receive lists password PasswordPost - bool to receive lists password post flag Return values This function returns TRUE if the list is configured for moderation. Otherwise it returns FALSE. Remarks This function gets the lists password placing it in Password and if the list is required to use a password PasswordPost will be set to TRUE. Example char Email[256]; char Password[256]; bool PasswordPost; if (MD_ListModerated("mylist@mydomain.com", Email, Password, PasswordPost)) // do something else // do something else Back to API reference ---------------------------- GATEWAY MANAGEMENT FUNCTIONS ---------------------------- These functions allow management of gateway domains. Some of them require either the name of a valid gateway domain or an MD_Gateway structure. Where the name of a gateway is required this is the complete domain name for the gateway. For example 'my.gateway.com'. struct MD_Gateway { char GatewayName[GATEWAY_LEN+1]; char MailDir[MAILDIR_LEN+1]; char MBF[MAX_PATH]; char FWDHost[FWDHOST_LEN+1]; char FWDAddress[FWDADDR_LEN+1]; char FWDSendAs[FWDSENDAS_LEN+1]; char FWDPort[PORT_LEN+1]; char ETRNHost[FWDHOST_LEN+1]; char ETRNPort[PORT_LEN+1]; char Email[EMAIL_LEN + 1]; char Password[PASSWORD_LEN + 1]; char SharedSecret[SHAREDSECRET_LEN+1]; char SendWarningTo[FWDADDR_LEN+1]; char SendWarningFrom[FWDADDR_LEN+1]; char MaxMessageCount[MAXMESSAGECOUNT_LEN + 1]; char MaxDiskSpace[MAXDISKSPACE_LEN + 1]; char LDAPHost[GWLDAPHOST_LEN + 1]; char LDAPPort[PORT_LEN+1]; char LDAPBaseEntry[GWLDAPBASEENTRY_LEN + 1]; char LDAPRootDN[GWLDAPROOTDN_LEN + 1]; char LDAPRootPass[GWLDAPROOTPASS_LEN + 1]; char LDAPSearchFilter[GWLDAPSEARCHFILTER_LEN + 1]; int LDAPSearchScope; char* IPList; int Flags; }; Fields GatewayName - the name (domain name) of the gateway MailDir - the directory on disk where the gateway's messages are stored MBF - the name of the MBF file that the gateway is using FWDHost - the host to which messages will be sent if forwarding is enabled FWDAddress - the address to which messages will be sent if forwarding is enabled FWDSendAs - the email address MD will send forwarded mail from FWDPort - the port that forwarded mail will be sent to ETRNHost - the host to which message will be sent if ETRN support is enabled ETRNPort - the port that messages will be sent to if ETRN support is enabled Email - local account email which provides access to MailDir using POP/IMAP Password - password of a local account specified in Email SharedSecret - AUTH shared secret SendWarningTo - email address to receive notifications of gateway events SendWarningFrom - email address which sends notifications of gateway events MaxMessageCount - maximum number of messages allowed in MailDir MaxDiskSpace - maximum disk space allocated to the gateway IPList - double NULL terminated list of IPs that are allowed to ETRN/ATRN gateway mail Flags - bit mask holding various gateway flags Remarks The Flags field is a bitmask which can contain one or more of the following bit flags: MDGW_AUTOEXTRACT - attachments will be extracted from all gateway mail and placed in the FILES directory (within the gateway's mail directory) MDGW_FWDTOHOST - gateway should forward copies to host specified in FWDHost MDGW_FWDTOADDR - gateway should forward copies to address specified in FWDAddress MDGW_KEEPLOCALCOPY - gateway retains local copy of forwarded messages MDGW_ETRN - gateway is configured to honor ETRN requests MDGW_USESPECIFICHOST - gateway ETRN is configured to send to host specified in ETRNHost MDGW_USEANYHOST - gateway ETRN is configured to send to host making ETRN request MDGW_HONORIPS - IPList contains list of IPs that CAN ETRN/ATRN MDGW_IGNOREIPS - IPList contains list of IPs that CAN NOT ETRN/ATRN MDGW_TREATASFOREIGN - always consider host in ETRNHost as a foreign mail server MDGW_AUTH - gateway is configured to use AUTH MDGW_ATRN - gateway is configured to use ATRN MDGW_LOCKATRN - only a single ATRN session is allowed at a time MDGW_AUTHALWAYSVALID - authenticated ETRN/ATRN requests are valid regardless of connecting IP MDGW_REQUIREAUTH - authentication is required when sending mail as a user of this gateway MDGW_APPLYQUOTAS - gateway is configured to utilize quota settings MDGW_SENDWARNING - gateway is configured to send notifications messages Back to API reference
int MD_GetGatewayCount() This function returns the total number of gateways currently defined. Return values This function returns the total number of gateways currently defined. Back to API reference
void MD_GetGatewayNames( char* Buffer // buffer to receive gateway list int BufLen // length of buffer ) This function places all gateway names into Buffer without exceeding BufLen. Parameters Buffer - this is the buffer which will receive the gateway list BufLen - this is the maximum length of Buffer Remarks Buffer will contain a NULL separated list of all MDaemon gateway names. The end of the string will be double NULL terminated. For example, the resulting string might look like this: "altn.com\0arvel.altn.com\0arvelh.com\0\0" If Buffer is not long enough to contain all the data then as many gateway names as will fit will be placed into Buffer. To be sure that the size of Buffer is allocated with enough space you can do something like this: int Size = MD_GetGatewayCount() * (GATEWAY_LEN+1); char* Buffer = new char[Size + 1]; MD_GetGatewayNames(Buffer, Size); char* ptr = Buffer; while (*ptr != '\0') { sprintf(Str, "Gateway Name: %s", ptr); ptr += strlen(ptr)+1; } Back to API reference
void MD_InitGatewayInfo( MD_Gateway* Gateway // Pointer to MD_Gateway structure const char* Name // Name of gateway (domain name) ) This function initializes an MD_Gateway structure Parameters Gateway - Pointer to MD_Gateway structure which will be initialized Name - the domain name of this gateway (ex: my.gateway.com) Return values None Remarks This function initializes Gateway to various default settings. It must be called prior to using an MD_Gateway structure. Name must be the domain name the gateway (ex: my.gateway.com). If the gateway does not exist it is created. If it does exist then the Gateway member is initialized to the existing gateways values. This function allocates a block of memory for the IPList member which can only be freed by calling MD_FreeGateway(). Each call to MD_InitGatewayInfo() must have a corresponding call to MD_FreeGateway(). Calling MD_InitGatewayInfo() multiple times using the SAME MD_Gateway structure will result in a memory leak. Example MD_Gateway Gateway; MD_InitGatewayInfo(&Gateway, "my.gateway.com"); Back to API reference
int MD_VerifyGatewayInfo( MD_Gateway* Gateway // Pointer to MD_Gateway structure ) This function verifies the content of the passed MD_Gateway structure. Parameters Gateway - Pointer to MD_Gateway structure Return values This value returns one of the following values: MDGWERR_NOERROR - no error found MDGWERR_INVALIDGWNAME - the name of the gateway is errant (for example it is a complete email address rather than just a domain name) MDGWERR_INVALIDMAILDIR - the MailDir member is invalid MDGWERR_INVALIDFWD - the forwarding address members are invalid or incomplete MDGWERR_INVALIDETRN - the ETRN members are invalid or incomplete MDGWERR_INVALIDAUTH - the AUTH members are invalid or incomplete MDGWERR_INVALIDATRN - the ATRN members are invalid or incomplete MDGWERR_INVALIDSENDWARNING - the email address given is errant MDGWERR_INVALIDLDAP - LDAP verification parameter is errant Remarks This function verifies that the passed MD_Gateway structure is configured with acceptable settings. It must be called prior to calling MD_WriteGateway(). Example MD_Gateway Gateway; MD_InitGatewayInfo(&Gateway, "my.gateway.com"); Gateway->Flags |= MDGW_AUTOEXTRACT; if (MD_VerifyGatewayInfo(&Gateway) == MDGWERR_NOERROR) MD_WriteGateway(&Gateway); Back to API reference
bool MD_WriteGateway( MD_Gateway* Gateway // Pointer to MD_Gateway structure ) This function write the gateway to disk. Parameters Gateway - Pointer to MD_Gateway structure Return values This function returns TRUE if the gateway settings were written to disk. Otherwise it returns FALSE. Example MD_Gateway Gateway; MD_InitGatewayInfo(&Gateway, "my.gateway.com"); Gateway->Flags |= MDGW_AUTOEXTRACT; if (MD_VerifyGatewayInfo(&Gateway) == MDGWERR_NOERROR) MD_WriteGateway(&Gateway); Back to API reference
bool MD_DeleteGateway( const char* Name // Name of gateway to delete bool RemoveDir // Flag to remove gateway directory ) This function deletes a gateway domain. Parameters Name - name (domain name) of the gateway to delete RemoveDir - delete the gateway's mail directory? Return values None Remarks The gateway is completely deleted from disk. Use with care. If RemoveDir is TRUE then all messages in the gateway's mail directory and the directory itself are erased from disk. Example MD_DeleteGateway("my.gateway.com", TRUE); Back to API reference ---------------------------- ALIAS MANAGEMENT FUNCTIONS ---------------------------- These functions allow management of aliases.
bool MD_DeleteAllAliases( const char* Email // Email address ) This function deletes all aliases for a given email address gateway domain. Parameters Email - the email address of the person who's aliases are to be removed Return values This function returns TRUE if at least one alias for Email was found and removed. Otherwise it returns FALSE. Remarks All aliases for Email are removed and the alias database is updated and reloaded into memory. Example MD_DeleteAllAliases("arvel@altn.com"); Back to API reference
bool MD_DeleteAlias( const char* Email // Email address const char* Alias // Alias ) This function deletes a specific alias from the alais database. Parameters Email - the email address of the person who owns Alias Alais - the alias to remove Return values This function returns TRUE if the Alias for Email was found and removed. Otherwise it returns FALSE. Remarks The specified Alias for Email is removed and the alias database is updated and reloaded into memory. Example MD_DeleteAlias("arvel@altn.com", "AliasForArvel@altn.com"); Back to API reference
bool MD_CreateAlias( const char* Email // Email address const char* Alias // Alias ) This function creates a new alias. Parameters Email - the email address of the person receiving the alias Alais - the actual alias for Email Return values This function returns TRUE if the Alias for Email was added. Otherwise it returns FALSE. Remarks The specified Alias for Email is created and the alias database is updated and reloaded into memory. Example MD_CreateAlias("arvel@altn.com", "AliasForArvel@altn.com"); Back to API reference ---------------------------- ACCOUNT TEMPLATE FUNCTIONS ---------------------------- These functions allow management of account templates. Account templates are sets of account settings (like Forwarding information, autoresponder information, what mail and web services are allowed, etc). Most of the settings you find in the account editor and which are part of an MD_UserInfo structure can be pre-configured using an account template. You can then assign an account template to a user through the grouping feature/API.
bool MD_TemplateExists( const char* TemplateName // Name of a template ) This function tests to see if a template exists. Parameters TemplateName - the name of the template to look for Return values This function returns TRUE if a template by the given name already exists, otherwise FALSE. Remarks Use this function to see if a template by a given name already exists. When you create or edit a template you can name it but the name has to be unique. Example const char TemplateName[] = "My Test Template"; if (!MD_TemplateExists(TemplateName)) { MD_UserInfo UserInfo; MD_InitUserInfoByTemplate(&UserInfo, TemplateName); // Maybe make some changes to UserInfo before saving it back out UserInfo.HideFromEveryone = true; MD_TemplateWrite(UserInfo, TemplateName); } Back to API reference
char* MD_TemplateGetAll( ) This function returns a list of all existing templates. Parameters None Return values This function returns a pointer to a double-null terminated list of existing template names. Remarks Use this function to get a list of all the templates that currently exist. Templates are stored in ACCOUNTTEMPLATES.DAT. The calling application must call MD_TemplateFree to free the memory allocated by this function. Example char* ptr = MD_TemplateGetAll(); if (ptr) { char* p = strtok(ptr, ","); while (p) { MD_UserInfo UserInfo; MD_InitUserInfoByTemplate(&UserInfo, p); // do something with the template settings which are now in // UserInfo. p = strtok(NULL, ","); } MD_TemplateFree(ptr); }
Back to API reference void MD_TemplateFree( char* Buffer // pointer to free ) This function frees memory allocated by other template related functions. Parameters Buffer - Pointer to be freed Return values none Remarks Some template related functions allocate memory which must be freed by calling this function. Example char* TemplateNames = MD_TemplateGetAll(); if (TemplateNames) { // do something with TemplateNames MD_TemplateFree(TemplateNames); } Back to API reference bool MD_TemplateCreate( const char* TemplateName // Name of template to create ) This function creates a new template and writes it to disk with default settings. Parameters TemplateName - Name of template to create Return values Returns TRUE if template was created, FALSE otherwise. Remarks This function creates a new template and saves it to disk. The name of the template is a string passed into the function. After creation the new template will contain installation defaults for all account template settings. Example const char* NewTemplateName[] = "New Template"; if (MD_TemplateCreate(NewTemplateName)) { MD_UserInfo UserInfo; MD_InitUserInfoByTemplate(&UserInfo, NewTemplateName)); // UserInfo now contains all the settings of NewTemplateName // Maybe change some of them... UserInfo.HideFromEveryone = true; MD_TemplateWrite(&UserInfo, NewTemplateName); } Back to API reference void MD_TemplateWrite( MD_UserInfo* UserInfo // Pointer to structure containing account settings const char* TemplateName // Name of the template ) This function writes an account template to disk. Parameters UserInfo - Structure containing account settings to store as a template TemplateName - The name of the template Return values None Remarks This function writes an account template to disk. The settings to associate with the template are provided in UserInfo. The template values are stored in AccountTemplates.dat under the TemplateName provided. Example const char* NewTemplateName[] = "New Template"; if (MD_TemplateCreate(NewTemplateName)) { MD_UserInfo UserInfo; MD_InitUserInfoByTemplate(&UserInfo, NewTemplateName)); // UserInfo now contains all the settings of NewTemplateName // Maybe change some of them... UserInfo.HideFromEveryone = true; MD_TemplateWrite(&UserInfo, NewTemplateName); } Back to API reference bool MD_TemplateRename( const char* OldTemplateName // Old template name const char* NewTemplateName // New template name ) This function renames an existing template. Parameters OldTemplateName - original existing template name NewTemplateName - new template name Return values Returns TRUE if existing template was renamed, FALSE otherwise. Remarks This function renames an existing account template. Example const char* OldTemplateName[] = "My Old Template"; const char* NewTemplateName[] = "My New Template"; if (MD_TemplateRename(OldTemplateName, NewTemplateName)) { } Back to API reference bool MD_TemplateDelete( const char* TemplateName // Name of template to delete ) This function deletes an existing template. Parameters TemplateName - name of template to delete Return values Returns TRUE if existing template was deleted, FALSE otherwise. Remarks This function deletes an existing account template. Example const char* TemplateName[] = "My Template"; if (MD_TemplateDelete(TemplateName)) { } Back to API reference