Create New PST in PHP

Aspose.Email - Create New PST

To Create new PST using Aspose.Email Java for PHP, simply invoke CreatePST module. Here you can see example code.

PHP Code


 # Create an instance of PersonalStorage

$personalStorage=new PersonalStorage();

$pst = $personalStorage->create($dataDir . "sample1.pst", 0);

\# Create a folder at root of pst

$pst->getRootFolder()->addSubFolder("myInbox");

\# Add message to newly created folder

$mapi_message = new MapiMessage();

$pst->getRootFolder()->getSubFolder("myInbox")->addMessage($mapi_message->fromFile($dataDir . "Message.msg"));

print "Created PST successfully.".PHP_EOL;

Download Running Code

Download Create New PST (Aspose.Email) from any of the below mentioned social coding sites: