Images

Manage your uploaded files and enable or disable them from here. By default, this feature is enabled.
mailui.init({ features: { userUploads: { enabled: true }, }, });

Fetch Uploads Listener #

If you want full control over image uploading, fetching, and management, you can use the following callbacks for uploading, fetching, and removing images.
mailui.registerProvider( "userUploads", async (params: { page: number; perPage: number; mediaType: MediaType }, done: Function) => { done(data, meta); } );

Params #

PropertyDescriptionTypeDefault
pageThe current page numbernumber1
perPageThe number of items displayed per pagenumber20
mediaTypeDifferent type of media can be specify
image icon
image

Callback Data #

PropertyDescriptionTypeDefault
idUnique numberany-
fileNameMedia file namestring-
srcMedia full urlstring-
altMedia alt textstring-

Callback Meta #

PropertyDescriptionTypeDefault
pageThe current page numbernumber1
lastPageThe total number of pagesnumber-
perPageThe number of items displayed per pagenumber20
totalThe total number of itemsnumber-

On Upload Listener #

Triggers when a user uploads files, handling and processing them as needed.
mailui.registerProvider( "image:onUpload", async (params: { file: File; mediaType: MediaType }, done: Function) => { try { const media = {}; done(media); } catch (error) { done(null); console.log("An error has occurred during upload file."); } } );

Params #

PropertyDescriptionTypeDefault
fileUploaded BLOB file typefile-
mediaTypeDifferent type of media can be specify
image icon
image

Media Properties #

PropertyDescriptionTypeDefault
idUnique numberstring | number-
fileNameMedia file namestring-
srcMedia full urlstring-
altMedia alt textstring-

Remove Listener #

Triggers when a user remove uploaded files, handling and processing them as needed.
mailui.registerCallback("image:onRemove", async (image: Media, done: Function) => { // Add your code here done(); });

Params #

PropertyDescriptionTypeDefault
imageImage has all media properties {id: '', fileName: '', src: '', alt: ''}media{}-

Explore Our Email Builder