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");
     # 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("from@domain.com", "Sender Name", false));
     # Add TO recipients
     $message->getTo()->add(new MailAddress("to@domain.com", "Recipient 1", false));
     # Message subject
     $message->setSubject("Customizing Email Headers");
     # Specify Date
     $timeZone = new TimeZone();
     $calendar = new Calendar();
     $calendar = $calendar->getInstance($timeZone->getTimeZone("GMT"));
     $date = $calendar->getTime();
     $message->setDate($date);
     # Specify XMailer
     $message->setXMailer("Aspose.Email");
     # Specify Secret Header
     $message->getHeaders()->add("secret-header", "mystery");
     # Save message to disc
     $messageFormat = new MessageFormat();
     $message->save($dataDir . "MsgHeaders.msg", $messageFormat->getMsg());
     # Display Status
     print "Customized message headers Successfully." . PHP_EOL;
 }
 public static function run($dataDir = null)
 {
     $contact = new MapiContact();
     $calendar = new Calendar();
     $timeZone = new TimeZone();
     $calendar = $calendar->getInstance($timeZone->getTimeZone("GMT"));
     $calendar->set(2012, $calendar->NOVEMBER, 1, 0, 0, 0);
     $startDate = $calendar->getTime();
     $calendar->set(2012, $calendar->DECEMBER, 1);
     $endDate = $calendar->getTime();
     $task = new MapiTask("To Do", "Just click and type to add new task", $startDate, $endDate);
     $task->setPercentComplete(20);
     $task->setEstimatedEffort(2000);
     $task->setActualEffort(20);
     $mapiTaskHistory = new MapiTaskHistory();
     $task->setHistory($mapiTaskHistory->Assigned);
     $task->getUsers()->setOwner("Darius");
     $task->getUsers()->setLastAssigner("Harkness");
     $task->getUsers()->setLastDelegate("Harkness");
     $mapiTaskOwnership = new MapiTaskOwnership();
     $task->getUsers()->setOwnership($mapiTaskOwnership->AssignersCopy);
     $companies = ["company1", "company2", "company3"];
     $task->setCompanies($companies);
     $categories = ["category1", "category2", "category3"];
     $task->setCategories($categories);
     $task->setMileage("Some test mileage");
     $task->setBilling("Test billing information");
     $task->getUsers()->setDelegator("Test Delegator");
     $mapiSensitivity = new MapiSensitivity();
     $task->setSensitivity($mapiSensitivity->Personal);
     $mapiTaskStatus = new MapiTaskStatus();
     $task->setStatus($mapiTaskStatus->Complete);
     $taskSaveFormat = new TaskSaveFormat();
     $task->save($dataDir . "MapiTask.msg", $taskSaveFormat->Msg);
     print "Created outlook task successfully." . PHP_EOL;
 }