public static function run($dataDir = null) { # Create a new instance of MailMessage class $message = new MailMessage(); # Set subject of the message $message->setSubject("New message created by Aspose.Email for Java"); $mail_address = new MailAddress(); # Set Html body $message->setHtmlBody("<b>This line is in bold.</b> <br/> <br/>" . "<font color=blue>This line is in blue color</font>"); # Set sender information $message->setFrom(new MailAddress("*****@*****.**", "Sender Name", false)); # Add TO recipients $message->getTo()->add(new MailAddress("*****@*****.**", "Recipient 1", false)); $message->getTo()->add(new MailAddress("*****@*****.**", "Recipient 2", false)); # Create an instance of MapiMessage and load the MailMessag instance into it $mapiMessage = new MapiMessage(); $mapi_msg = $mapiMessage->fromMailMessage($message); # Set the MapiMessageFlags as UNSENT and FROMME $mapi_message_flags = new MapiMessageFlags(); // $mapi_msg->setMessageFlags($mapi_message_flags->MSGFLAG_UNSENT || $mapi_message_flags->MSGFLAG_FROMME); # Save the MapiMessage to disk $mapi_msg->save($dataDir . "New-Draft.msg"); # Display Status print "Draft saved Successfully." . PHP_EOL; }
public static function run($dataDir = null) { $mapiMessage = new MapiMessage(); $mess = $mapiMessage->fromFile($dataDir . "MapiNote.msg"); # Note #1 $note1 = $mess->toMapiMessageItem(); $note1->setSubject("Yellow color note"); $note1->setBody("This is a yellow color note"); # Note #2 $note2 = $mess->toMapiMessageItem(); $note2->setSubject("Pink color note"); $note2->setBody("This is a pink color note"); $noteColor = new NoteColor(); $note2->setColor($noteColor->Pink); # Note #3 $note3 = $mess->toMapiMessageItem(); $note2->setSubject("Blue color note"); $note2->setBody("This is a blue color note"); $note2->setColor($noteColor->Blue); $note3->setHeight(500); $note3->setWidth(500); $personalStorage = new PersonalStorage(); $fileFormatVersion = new FileFormatVersion(); $pst = $personalStorage->create($dataDir . "MapiNoteToPST.pst", $fileFormatVersion->Unicode); $standardIpmFolder = new StandardIpmFolder(); $notes_folder = $pst->createPredefinedFolder("Notes", $standardIpmFolder->Notes); $notes_folder->addMapiMessageItem($note1); $notes_folder->addMapiMessageItem($note2); $notes_folder->addMapiMessageItem($note3); print "Added MapiNote Successfully." . PHP_EOL; }
public static function run($dataDir = null) { $mapiMessage = new MapiMessage(); $outlook_message_file = $mapiMessage->fromFile($dataDir . "Message.msg"); # Display sender's name print "Sender Name : " . $outlook_message_file->getSenderName(); #Display Subject print "Subject : " . $outlook_message_file->getSubject(); # Display Body print "Body : " . $outlook_message_file->getBody(); }
public static function run($dataDir = null) { # 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; }
public static function run($dataDir = null) { $personalStorage = new PersonalStorage(); $fileFormatVersion = new FileFormatVersion(); $pst = $personalStorage->create($dataDir . "search.pst", $fileFormatVersion->Unicode); $standardIpmFolder = new StandardIpmFolder(); $fi = $pst->createPredefinedFolder("Inbox", $standardIpmFolder->Inbox); $mapiMessage = new MapiMessage(); $mailMessage = new MailMessage(); $fi->addMessage($mapiMessage->fromMailMessage($mailMessage->load($dataDir . "search.pst"))); $builder = new MailQueryBuilder(); $builder->getFrom()->contains("automated", true); $query = $builder->getQuery(); $coll = $fi->getContents($query); print "Total Results:" . (string) $coll->size(); }