Create specified mailbox.
[Syntax] C++: HRESULT CreateMailBox( BSTR MailBox, long* pVal ) Visual Basic: CreateMailBox( MailBox As String ) As long C#: long CreateMailBox( string MailBox )
Parameters
MailBox
Mailbox to be created.
Return Value
If this method succeeds, the return value is zero. If it fails, the return value is non-zero.
Remarks
Default root directory of mailbox is anpop.dll current directory\MailFolders. eg: C:\Program Files\AdminSystem.NET\ANPOP\MailFolders. All mailboxes created by CreateMailBox method are default to be saved in this folder. SetRootPath method can be used to set root of mailbox to another directory.
Usage Example
[Visual Basic]
Sub CreateMailBox
Dim oStore As ANPOPLib.MSGSTORE
Dim mailBox As String
mailBox = "Inbox"
Set oStore = new ANPOPLib.MSGSTORE
If oStore.IsMailBoxExisted( mailBox ) = 0 Then
MsgBox "mailbox exists"
Exit Sub
End If
If oStore.CreateMailBox( mailBox ) = 0 Then
MsgBox "create mailbox succeeded"
Else
MsgBox "create mailbox failed"
End If
End Sub
[C#]
public void CreateMailBox()
{
MSGSTOREClass oStore = new MSGSTOREClass();
string mailBox = "Inbox";
try
{
if( oStore.IsMailBoxExisted( mailBox ) == 0 )
throw new Exception( "mailbox exists" );
if( oStore.CreateMailBox( mailBox ) != 0 )
throw new Exception( "create mailbox failed" );
Console.WriteLine( "create mailbox succeeded" );
}
catch( Exception e)
{
Console.WriteLine( e.Message );
}
oStore = null;
}
2001-2007 © Copyright AdminSystem Software Limited. All rights reserved.