SDK Setup

Aspose.Email Cloud API

Aspose.Email Cloud API is a Cloud SDKs to send, receive, append, flag and convert cloud emails & support to create folder structure for email archiving in the cloud. This is easy to use and fast API, that doesn’t need to install the additional software. The API supports many programming languages, such as C#, Java, PHP, Python, Ruby & Typescript. To start working with Aspose.Email Cloud API you need to install a proper SDK. To know how to install SDK follow the instructions below.

Install SDK

SDK packages available at package repositories:

Use your package manager to install an SDK:

How to install SDK?

Get Your Client secret and Client id

Before we will get our Client secret and Client id, let’s find out: what is it and what are they for?

Simply put, Client id is a login and Client secret is a password. You can create more than one app and each one will have it’s own Client secret and Client id. You can use these apps within your services. Using the Aspose.Cloud Dashboard helps you to filter the statistics of your applications in My Usage section.

Here, you see the example of the apps’ statistics. In the Application column, you can see from which application was a request, also, there are details, status, and sender’s IP address of a request.

My Usage section

Client secret and Client id are used to get the temporary JWT token, which provides access to the API methods of Aspose.Email Cloud. These tokens can be seen in curl requests generated in the Swagger UI.

Our SDKs do not require you to receive these tokens again and again as they become obsolete. Instead, the EmailCloud class stores Client secret and Client id in itself and receive a token by itself. If the token is out of date, Aspose.Email SDKs automatically receive a new one.

To get your Client secret and Client id follow these steps:

  1. Open the link of Aspose.Cloud Dashboard
  2. Sign in or sign up
  3. Open link
  4. Now you can create a new app or use First App, which is already created for you.
  5. Get Client id and Client secret for your application to use them in SDK (you can also use them in our Swagger UI)

Aspose.Cloud Dashboard is a powerful tool where you can control your apps, storages and files.

Set up EmailCloud Object

It is always convenient when everything is in one place. In our case, one of the main classes that will help us in development - EmailCloud.

All API methods are available in one EmailCloud class. To initialize EmailCloud object we need to pass into it 2 required parameters: Client secret and Client id (which are strings).

So, what are we waiting for, let’s create an instance of it:

How to set up EmailCloud object?

Our SDK automatically gets API token using your clientSecret and ClientId. Also, it automatically gets a new token, if previous one is expired.

Check Everything Works

After setting up Aspose.Email Cloud API SDK, it’s time to start using it. The API has numerous functions for working with email messages, calendars, contacts, etc.. Also, the API includes AI functions such as the Business Card Recognition API and Name API. These features will facilitate and speed up the development of your application. 

Let’s call some SDK methods to see that everything set up properly. For example, you can easily convert an EML file to MSG format with our API.

EmailApi object has a function to convert email messages, it’s called Convert which converts email document to the specified format and returns as the file.

This function requires only one parameter — EmailConvertRequest, which requests a model for conversion. To create a request you need to pass 3 parameters:

  • toFormat - a file format you want to convert to (Enum: Eml, Msg, MsgUnicode, Mhtml, Html).
  • fromFormat - a file format you want to convert from.
  • file - a file to upload for the further converting. 

How to convert EML to MSG?

Looks that everything is working. Now you can start the development!

Some Tips

We still advise you to read all the documentation in order to fully master this API.

You can use the trial version of the Aspose.Email Cloud API to try it out. The trial version has some restrictions, so, if you need the full power of our solution — we will be happy to see you as one of our customers.

Don’t be shy to ask questions on our free forum or the special paid forum for our customers, we will answer as soon as possible and help to solve your problems.

See More Tutorials

Take a look at other tutorials, you may find answers on your questions there: