1. Products
  2.   Email
  3.   PHP
  4.   Aspose.Email Cloud SDK for PHP

Aspose.Email Cloud SDK for PHP

 
 

PHP REST API to Create & Convert MS Outlook Emails

PHP Email Processing Cloud SDK that allows to Compose, Send, Receive, Edit & Convert Outlook MSG, MHT, EML, EMLX, and other Email File Formats.

What is Aspose.Email Cloud SDK for PHP?

The Aspose.Email Cloud SDK for PHP stands as a highly capable and dependable tool for software developers aiming to incorporate comprehensive email management functionality directly into their PHP-based applications. Built upon the robust foundation of the widely-adopted Aspose.Email Cloud API, this SDK simplifies complex operations by delivering an extensive suite of features for handling email messages, managing multiple attachments, processing calendars, and automating a host of related tasks. It leverages a powerful and scalable cloud infrastructure, guaranteeing consistent performance, high availability, and the ability to seamlessly manage high volumes of email traffic and data without compromising reliability or speed.

Engineered for simplicity and versatility, this SDK provides a rich array of functionalities essential for modern email processing within custom PHP applications. Developers can effortlessly create and send both simple and complex MIME-formatted emails, manage CC and BCC recipients, encode and decode message content, and manipulate email document headers with full control over delivery notifications. The toolkit further extends to managing email contacts, scheduling appointments via calendar integration, marking priority emails with flags, and fetching detailed email properties. A key strength is its powerful conversion engine, allowing seamless transformation of email messages between popular formats like EML, MSG, MHTML, and HTML. With built-in support for standard email protocols such as SMTP, POP3, and IMAP, the Aspose.Email Cloud SDK for PHP offers unmatched flexibility to integrate sophisticated email messaging capabilities into web applications, mobile platforms, and desktop software. Ultimately, it represents the ideal solution for building robust, scalable, and high-performance email messaging systems designed to support a large number of users and messages efficiently.

Previous Next

Getting Started with Aspose.Email Cloud SDK for PHP

The recommend way to install Aspose.Email Cloud SDK for PHP is using composer. Please use the following command for a smooth installation.

Install Aspose.Email Cloud SDK for PHP via Composer

composer require aspose/aspose-email-cloud 
You can also download it directly from Aspose product page.

Create and Manage Email Messages

Aspose.Email Cloud SDK for PHP is an excellent choice for developers who want to create, send, receive, append, flag, and convert cloud emails inside their own PHP applications. The API supports working with various email file formats such as EML, MSG, MHTML, and HTML format. There are several important features part of the library for working with email messages, such as creating email messages from the scratch, send an email with attachments, inserting customize title for email messages, setting email date, Adding CC and BCC recipients, and many more.

How to Create Email File via PHP API?

$email = (new EmailDto())
    ->setFrom(new MailAddress("Organizer Name", "organizer@aspose.com"))
    ->setTo(array(new MailAddress("Attendee Name", "attendee@aspose.com")))
    ->setSubject("Some subject")
    ->setBody("Some body");

$storage = "First storage";
$folder = "folder/on/storage"; 
$emailFile = "email.eml";
$format = "Eml";

$api->email()->save(new EmailSaveRequest(
    new StorageFileLocation($storage, $folder, $emailFile),
    $email, $format));

Create & Manage Appointments via PHP REST API

An ICS file format is used to for iCalendar which is a standardized format for storing and transmitting calendar data. Aspose.Email Cloud SDK for PHP enables software developers to create and read iCalendar (.ics) files inside their own PHP applications. The SDK supports several important features for handling appointments using PHP commands, such as creating a new appointment, Getting appointments from a specific folder, getting details of a specific appointment, updating an existing appointment, Deleting an appointment, and so on. The following example shows how software developers can Create a new appointment inside the PHP application.

How to Create a New Appointment inside PHP Applications?

$api = new \Aspose\Email\Api\AppointmentApi(null, $config);

$request = new \Aspose\Email\Model\CreateAppointmentRequest();
$request->setMailAccountId("Your email account ID");
$request->setFolder("Calendar");
$request->setAppointment($appointment); // replace $appointment with your appointment object
$response = $api->createAppointment($request);
//Get details of a specific appointment:
$request = new \Aspose\Email\Model\GetAppointmentRequest();
$request->setMailAccountId("Your email account ID");
$request->setFolder("Calendar");
$request->setMessageId("Appointment ID");
$response = $api->getAppointment($request);
$appointment = $response->getAppointment();

Convert Email Message & Contact Files via PHP API

Aspose.Email Cloud SDK for PHP has included complete support for converting email messages and contact files to other supported file formats inside their own PHP applications. The library has provided support for email messages conversion to EML, MSG, MHTM, HTML and many more. It also provides support for converting iCalendar to Microsoft Outlook MSG, creating iCalendar to MAPI or ICS files, converting MSG file to an iCalendar file, Convert Calendar File to ICS, Convert VCard Files, and many more. The following example demonstrates how to convert email message file formats using PHP commands.

How to Convert MSG Email Message to EML via PHP API?

$emailDto = (new EmailDto())
    ->setFrom(new MailAddress(null, 'from@aspose.com'))
    ->setTo(array(new MailAddress(null, 'to@aspose.com')))
    ->setSubject('Some subject')
    ->setBody('Some body')
    ->setDate(new DateTime());

$mapi = $api->email()->asFile(
    new EmailAsFileRequest('Msg', $emailDto));
$eml = $api->email()->convert(
    new EmailConvertRequest('Msg', 'Eml', $mapi));
$fileContent = $eml->fread($eml->getSize());
$this->assertRegExp(
    "/" . $emailDto->getFrom()->getAddress() . "/",
    $fileContent);
$dto = $api->email()->fromFile(
    new EmailFromFileRequest('Eml', $eml));
$this->assertEquals(
    $emailDto->getFrom()->getAddress(),
    $dto->getFrom()->getAddress());

 English