AIPEmailBuilderService
By utilizing the AIPEmailBuilderRestService instance, the AIPEmailBuilderService is able to carry out various server-side operations, such as email template conversions, through the execution of RESTful API calls.
Properties
restService: AIPEmailBuilderRestService
: An instance of theAIPEmailBuilderRestService
used to make RESTful API calls to convert email templates and perform other server-side operations.standardFonts: string[]
: An array of standard fonts used in email building.
Methods
convert(value: IPEmail): Promise<IMjmlServerResponse>:
ConvertsIPEmail
object to ready-to-use MJML and HTML.
Parameters:value
: The IPEmail
object to convert.
Returns: A Promise
that resolves to an IMjmlServerResponse
object with the MJML and HTML templates.
Usage
AIPEmailBuilderService
is an abstract service that provides conversion of IPEmail
object to ready-to-use MJML and HTML. It also includes an array of standard fonts used in email building. Here is an example usage of the convert
method:
This example demonstrates how to use the AIPEmailBuilderService
in your Angular application:
- Import the AIPEmailBuilderService and inject it into your component or service using Angular’s dependency injection mechanism.
- Create an asynchronous function, such as myConvertFunction(), to convert an IPEmail object into ready-to-use MJML and HTML. Call the convert() method of the emailBuilderService and pass the IPEmail object. The method returns a promise with an object containing the mjml and html properties. Use the await keyword to wait for the promise to resolve.
- Access the array of standard fonts provided by the AIPEmailBuilderService using the
standardFonts
property.
By following these steps, you can integrate the AIPEmailBuilderService into your Angular application and utilize its functionalities for converting IPEmail objects into MJML and HTML formats.
{% hint style=“info” %}
Note: There are two concrete implementations of the AIPEmailBuilderService
: ProAIPEmailBuilderServicefor
the Pro version and FreeAIPEmailBuilderServicefor
for the Free version.
The appropriate implementation will be provided automatically based on your configuration. {% endhint %}