-------- OVERVIEW -------- This documentation is in HTML format. We plan to do a better more detailed documentation in WinHelp format in the near future. Watch http://www.altn.com for details. ----------------- 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 management functions IMAP folder and rule management functions Mailing list management functions Gateway related functions API Reference ---------------- REVISION HISTORY ---------------- v6.5.0 ------ The following things were changed --------------------------------- The mailing list functions was migrated to use it's own DLL. To use the mailing list functions you must now call: LoadMDListDll() FreeMDListDll() The MD_ListIsMember function was changed to accept a new boolean parameter (CheckAdmins) The functions MD_GetByAlias() and MD_LogonUser() do not change the email address parameter when it matches an alias. The following functions have been added. -------------------------------------- MD_GetDomainsGAB v6.0.0 ------ This version of the DLL make changes to almost all the functions. As a result, alot of your code will need to be updated. These changes were needed to allow for the future intregration of database functionality. The following things were changed --------------------------------- The LP_MOVE constant was replaced with WM_MDUSERDLL_RELOADLISTS. The following members were added to the MD_MessageInfo structure: char ContentType[MDUSERDLL_MAXCONTENTTYPE_LEN+1]; char CharSet[MDUSERDLL_MAXCHARSET_LEN+1]; The MDUSERDLL_EDITLOCALONLY bit mask was changed to MDUSERDLL_EDITMAILRESTRICTIONS. The MD_SetEditLocalOnly function was renamed to MD_SetEditMailRestrictions. The MD_GetEditLocalOnly function was renamed to MD_GetEditMailRestrictions. The MD_GetLocalOnly and MD_SetLocalOnly function descriptions were removed from this document. They have not been part of the API for some time. The following members were added to the MD_List structure: char PublicFolderName[PUBLICFOLDER_LEN]; char PublicFolderAccessLevel[60]; The following new constants were defined for use with the MD_List ListFlags member: MDUSERDLL_USEPUBLICFOLDER MDUSERDLL_SYNCWITHPUBLICFOLDER The following new constants were defined for use with the MD_Rule structure: MDUSERDLL_STARTSWITH MDUSERDLL_ENDSWITH MDUSERDLL_EXISTS MDUSERDLL_DOESNOTEXIST The following constants were defined for use with various new public IMAP folder functions: MDUSERDLL_IMAPNOACCESS MDUSERDLL_IMAPREADACCESS MDUSERDLL_IMAPWRITEACCESS MDUSERDLL_IMAPEXPUNGEACCESS MDUSERDLL_IMAPCREATEACCESS The following structure was added. ---------------------------------- MD_MultiPOPItem The following functions have been added. -------------------------------------- MD_ClearSettingsCache MD_GetPublicIMAPFolderAccess MD_ListSyncWithPublicFolder MD_GetStringKey MD_SetStringKey MD_GetStringKey MD_SetStringKey MD_GetBoolKey MD_SetBoolKey MD_RenameSection MD_DeleteSection MD_GetSectionNames MD_InitMultiPOPItem MD_AddMultiPOPItem MD_DeleteMultiPOPItem MD_GetMultiPOPItems MD_SetMultiPOPItems MD_DeleteAllAliases MD_CreateAlias MD_DeleteAlias MD_GetCanModifyGAB MD_SetCanModifyGAB v5.0.1 ------ The following functions have been added. -------------------------------------- MD_ListSendSubAuth MD_ListSendUnSubAuth The following structure was added. ---------------------------------- MD_ListMember v5.0.0 ------ The following functions have changed. MD_GetPruningFlags MD_SetPruningFlags v4.0.0 ------ This version of the DLL adds several more functions to the DLL. They include functions to manipulate mailing lists and gateway domains. The following functions have been added. -------------------------------------- MD_RestrictInboundMail MD_SetInboundMailRestrictions MD_RestrictOutboundMail MD_SetOutboundMailRestrictions MD_GetPruningFlags MD_SetPruningFlags MD_GetUseDefaultPruning MD_SetUseDefaultPruning MD_InitGatewayInfo MD_VerifyGatewayInfo MD_WriteGateway MD_FreeGateway MD_DeleteGateway MD_InitListInfo MD_VerifyListInfo MD_WriteList MD_DeleteList MD_ListPrivate MD_ListAllowExpn MD_ListCrackMessage MD_ListRouteMessage MD_ListUseMemberNames MD_ListUseHtmlDigests MD_ListUseListName MD_ListInsertCaption MD_ListForceUniqueID MD_ListPasswordPost MD_ListIgnoreRcptErrors MD_ListNameInSubject MD_ListThreadNumbInSubject MD_ListAuthSubscribe MD_ListAuthAutoSubscribe MD_ListAuthUnsubscribe MD_ListAuthAutoUnsubscribe 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_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 v3.5.0 ------ This version of the DLL adds several more functions to the DLL. They all revolve around the new IMAP Mail Rules feature-set. These functions are available in the PRO version only. The following functions have been added. -------------------------------------- MD_FindFirstRule MD_FindNextRule MD_ReadRule MD_GetEditIMAPRules MD_SetEditIMAPRules MD_RuleStructToRuleString MD_RuleStringToRuleStruct MD_DeleteRule MD_AddRule MD_ChangeRule MD_MoveRuleUp MD_MoveRuleDown MD_GetIMAPFolders MD_CreateIMAPFolder v3.1.0 ------ This version of the DLL make changes to almost all the functions. As a result, alot of your code will need to be updated. These changes were needed to allow for the future intregration of database functionality. The following functions have been changed ----------------------------------------- MD_GetByEmail MD_GetByFullName MD_GetByMailbox MD_GetByMailDir MD_UserExists MD_GetFree (formerly called MD_FreeIndex) MD_GetByAlias (formerly called MD_TranslateUser) MD_FindFirst (formerly called MD_GetFirstUser) MD_FindNext (formerly called MD_GetNextUser) The following functions have been added -------------------------------------- MD_FindClose MD_GetAutoRespInfo MD_SetAutoRespInfo MD_EraseAutoResp The following functions have been removed ---------------------------------------- MD_FreeIndex MD_GetFirstUser MD_GetNextUser MD_TranslateUser MD_GetMaxDiskSpaceStr MD_SetMaxDiskSpaceStr MD_GetMaxMessageCountStr MD_SetMaxMessageCountStr MD_IsDynamicPassword MD_GetMaxUIDLCountStr MD_GetMaxMessageSizeStr 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 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_SetIsMDConfig 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 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_GetAllowAccess MD_SetAllowAccess MD_GetAllowChangeViaEmail MD_SetAllowChangeViaEmail MD_GetKeepForwardedMail MD_SetKeepForwardedMail MD_GetHideFromEveryone MD_SetHideFromEveryone MD_GetEncryptMail MD_SetEncryptMail 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_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_GetEditEncrypt MD_SetEditEncrypt MD_GetEditEveryone MD_SetEditEveryone MD_GetEditMailRestrictions MD_SetEditMailRestrictions MD_GetEditQuotas MD_SetEditQuotas MD_GetEditMultiPOP MD_SetEditMultiPOP MD_GetEditAutoResponder MD_SetEditAutoResponder MD_GetEditEmailChanges MD_SetEditEmailChanges MD_GetEditIMAPRules MD_SetEditIMAPRules MD_IsDynamicPasswordStr MD_GetMaxUIDLCount MD_SetMaxUIDLCount MD_GetMaxMessageSize MD_SetMaxMessageSize MD_RestrictInboundMail MD_SetInboundMailRestrictions MD_RestrictOutboundMail MD_SetOutboundMailRestrictions MD_GetPruningFlags MD_SetPruningFlags MD_GetUseDefaultPruning MD_SetUseDefaultPruning 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 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_ListUseHtmlDigests 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_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_InitGatewayInfo MD_VerifyGatewayInfo MD_WriteGateway MD_DeleteGateway --------------------------- 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
void MD_SetIsMDConfig( bool IsMDConfig // TRUE if app using DLL is MDConfig ) This function is reserved for use with MDConfig. It is not available for other applications. 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
bool 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_DELWARNDB - returns path to the delivery warning file MDUSERDLL_DELERRDB - returns path to the delivery error 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_ACCTINFODB - returns path to the account info file MDUSERDLL_WELCOMEDB - returns path to new account welcome 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_WEBACCESSDB - returns path to webconfig access rights database MDUSERDLL_RFC822TMPDB - returns path to rfc822 MBF file MDUSERDLL_DIGESTTMPDB - returns path to digest MBF file MDUSERDLL_IPSHIELDDB - returns path to IP shielding database MDUSERDLL_FWDDB - returns path to account forwarding database MDUSERDLL_SIGDB - returns path to signature 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_LANDOMAINDB - returns path to lan domain 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 This function returns TRUE if the specified database exists. Otherwise it returns FALSE. 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]; if (MD_GetDBPath(MDaemonIniFile, MDUSERDLL_MDAEMONINIDB)) // do something with file else // handle error 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.
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; 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
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 ---------------------------- 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 FWDPORT_LEN 8 #define USERDEFINED_LEN 256 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; bool AllowAccess; bool AllowChangeViaEmail; bool KeepForwardedMail; bool HideFromEveryone; bool EncryptMail; bool ApplyQuotas; bool EnableMultiPOP; bool CanModifyGAB; long MaxMessageCount; long MaxDiskSpace; int WebConfig; char FwdAddress[FWDADDR_LEN+1]; char FwdHost[FWDHOST_LEN+1]; char FwdSendAs[FWDSENDAS_LEN+1]; char FwdPort[FWDPORT_LEN+1]; char NTAccount[MAILBOX_LEN+1]; char MailFormat[MBXFORMAT_LEN+1]; char AutoRespScript[MAX_PATH+1]; char AutoRespProcess[MAX_PATH+1]; char AutoRespExclude[AUTORESPEXCLUDE_LEN+1]; char AddToList[EMAIL_LEN+1]; char RemoveFromList[EMAIL_LEN+1]; bool PassMessageToProcess; long MaxUIDLCount; long MaxMessageSize; bool RecurseIMAP; int MaxInactive; int MaxMessageAge; char Comments[COMMENT_LEN+1]; char UserDefined[USERDEFINED_LEN+1]; }; 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. AllowAccess - TRUE if account can access mailbox via POP/IMAP. 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. EncryptMail - TRUE if account is storing mail in an encrypted state. 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. MaxMessageCount - number of message account is allowed to store. MaxDiskSpace - number (in bytes) account's mail store can consume. WebConfig - bitmask specifying which WebConfig access rights are allowed. FwdAddress - the last known address the account is/was forwarding mail to. FwdHost - the last known host the account is/was forwarding mail thru. FwdSendAs - the last known HELO/EHLO value the account is/was using. FwdPort - the last known port the account was forwarding mail on. NTAccount - NT account name. MailFormat - mailbox storage format (MBF) file account is using. AutoRespScript - this is the full path to the account's auto responder script file. AutoRespProcess - this is the full path to a program the auto responder will execute. AutoRespExclude - this is a double null terminated list of addresses that are exempt from receiving the AutoRespScript file. AddToList - this is the mailing list the auto responder will sign people up to. RemoveFromList - this is the mailing list the auto responder will remove people from. PassMessageToProcess - TRUE if the message file triggering the auto responder should be passed to the AutoRespProcess program. MaxUIDLCount - max UIDL's to store for account's MultiPOP collection. MaxMessageSize - 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. 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_EDITENCRYPT // account can change mail encryption flag 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_EDITEMAILCHANGES // account can change setting via email 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 MaxMessageSize fields are values specified in BYTES. 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 12 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 12 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 3 for 2 substitution algorithm which means a 20 byte space within the user record can only contain a 12 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_DWEBACCESSDB - remove the account's webconfig access rights 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
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_EDITENCRYPT - query the Edit Encryption 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_EDITEMAILCHANGES - query the Edit Allow Email Changes 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_GetEditEncrypt MD_GetEditEveryone MD_GetEditMailRestrictions MD_GetEditQuotas MD_GetEditMultiPOP MD_GetEditAutoResponder MD_GetEditEmailChanges 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_EDITENCRYPT - set the Edit Encryption 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_EDITEMAILCHANGES - set the Edit Allow Email Changes 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_SetEditEncrypt MD_SetEditEveryone MD_SetEditMailRestrictions MD_SetEditQuotas MD_SetEditMultiPOP MD_SetEditAutoResponder MD_SetEditEmailChanges 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_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 none Example if (MD_GetAllowAccess(hUser)) // do something useful 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 none 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_GetEncryptMail( MD_HANDLE hUser // handle to a valid account record ) This function gets the state of the encrypt 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 encrypt mail. Otherwise it returns FALSE. Remarks none Example if (MD_GetEncryptMail(hUser)) // do something useful Back to API reference
void MD_SetEncryptMail( MD_HANDLE hUser // handle to a valid account record bool Value // new value ) This function sets the state of the encrypt 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_SetEncryptMail(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
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 BYTES). 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 BYTES). 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
long MD_GetMaxUIDLCount( MD_HANDLE hUser // handle to a valid account record ) This function gets the maximum UIDL count associated with MultiPOP mail for an account. Parameters hUser - handle to a valid account record. Return values This function returns the maximum number of unique UIDLs that will be stored for an account. Remarks UIDLs are checked when MultiPOP mail is collected and the 'Leave messages on server' option is enabled. Once this limit has been reached messages can no longer be left on the MultiPOP servers. Example long Max = MD_GetMaxUIDLCount(Index); // do something useful Back to API reference
void MD_SetMaxUIDLCount( MD_HANDLE hUser // handle to a valid account record long Value // new value ) This function sets the maximum UIDL count associated with MultiPOP mail for an account. Parameters hUser - handle to a valid account record. Value - new max UIDL count. Return values none Remarks MD_SetUserInfo is the recommended method of setting account data because it has error checking. Example MD_SetMaxUIDLCount(hUser, 500); Back to API reference
long MD_GetMaxMessageSize( 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_GetMaxMessageSize(Index); // do something useful Back to API reference
void MD_SetMaxMessageSize( 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_SetMaxMessageSize(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// buffer to receive the 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
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
long MD_GetDirSize( MD_HANDLE hUser // handle to a valid account record ) This function retrieves the total number of bytes 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 bytes 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 char* Address // buffer to receive forwarding address char* Host // buffer to receive forward to host char* SendAs // buffer to receive the HELO/EHLO value char* Port // buffer to receive the port ) 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 FWDPORT_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[FWDPORT_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 char* Address // forwarding address char* Host // forward to host char* SendAs // HELO/EHLO value char* Port // forwarding port ) 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 FWDPORT_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 char* Script // full path to auto responder script file char* Process // full path to auto responder program to run char* AddToList // add-to mailing list name char* RemoveFromList // remove-from mailing list name char* Exclude; // auto resp script list of excluded address bool& PassMessageToProcess // pass message to Process program? ) 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 const char* Script // full path to auto responder script file const char* Process // full path to auto responder program to run const char* AddToList // add-to mailing list name const char* RemoveFromList // remove-from mailing list name const char* Exclude; // auto resp script list of excluded address bool PassMessageToProcess // pass message to Process program? ) 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]; 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
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_MultiPOPItems* 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_MultiPOPItems* 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 --------------------------------- 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[128]; int ListFlags; int DigestFlags; int DefaultMode; int MaxMessageSize; int PrecedenceLevel; int RoutingLimit; int MaxMembers; int MaxMessageCount; int MaxLineCount; char ReplyAddress[256]; char RemoteHost[256]; char NotificationEmail[256]; char SendNotesTo[256]; char ModeratorEmail[256]; char ListPassword[256]; 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 PublicFolderName[PUBLICFOLDER_LEN]; char PublicFolderAccessLevel[60]; }; Fields ListName - the name (email address) of the mailing 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 - name of the MBF file to use with digests PublicFolderName - the name of the public folder tied to this list PublicFolderAccessLevel - access level when members are granted public folder access 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_INSERTCAPTION - list inserts a caption in TO: header 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_SYNCWITHPUBLICFOLDER - list is set to add subscribers and remove unsubscribers from public folder access list 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_HTMLDIGESTS - list digests are created in HTML format 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_ListUseHtmlDigests( 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 digests in HTML format. Otherwise it returns FALSE. Remarks This function is actually a macro which calls MD_GetListBoolKey. Example if (MD_ListUseHtmlDigests("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 returns a specific mailing list flag. Parameters ListName - the mailing list address (ex: mylist@domain.com) Return values This function returns the maximum lines of text 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_ListMaxLineCount("mylist@mydomain.com"); if (Result > SomeValue) // do something else // do something else 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 ) 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) 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 char Buffer[256]; if (MD_ListApplyFooter("mylist@mydomain.com", Buffer)) { if (Buffer[0] != '\0') // do something with Buffer } 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[DOMAIN_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[FWDPORT_LEN+1]; char ETRNHost[FWDHOST_LEN+1]; char ETRNPort[FWDPORT_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* 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_AUTHALWAYSVALID - authenticated ETRN/ATRN requests are valid regardless of connecting IP MDGW_APPLYQUOTAS - gateway is configured to utilize quota settings MDGW_SENDWARNING - gateway is configured to send notifications messages 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 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)) MD_WriteGateway(&Gateway); Back to API reference
bool MD_WriteGateway( MD_List* 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 list 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)) 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
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