Help Instance Help

m8ty_client_securemails

Secure Mail client to manage message exchanges with the end user.

Before you start

Check the documentation of the m8ty_client_securemails library to get an idea about the available models and their properties.

Import all needed libraries

import 'package:dio/dio.dart'; import 'package:m8ty_client_securemails/m8ty_client_securemails.dart'; import 'package:m8ty_client_common/m8ty_client_common.dart'; import 'package:built_collection/built_collection.dart';

Client Setup

final client = M8tyClientSecuremails(); client.setOAuthToken('ApiOAuth2', oauthToken);

API Surface

SecureMailApi

Method

Description

createNewSecureMail

Create new secure mail message

getSecureMailById

Get secure mail by id

searchSecureMail

Get user secure mail messages

deleteSecureMail

Delete secure mail by id

bulkDeleteSecureMail

Delete multiple secure mails

markSecureMailsAsRead

Mark secure mails as read by the user

getAllSecureMailRecipients

Get all possible contacts to send secure mail to

AttachmentsApi

Method

Description

getSecureMailAttachmentById

Get a specific secure mail message attachment

How to perform different tasks

Here some examples how the dart client can be used

Create a new secure mail

final client = M8tyClientSecuremails(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getSecureMailApi(); final Response<SecureMailModel> model = await api.createNewSecureMail( subject: "My message", content: "Here the content of my message", );

Get secure mail by id

final client = M8tyClientSecuremails(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getSecureMailApi(); final Response<SecureMailModel> secureMail = await api.getSecureMailById(secureMailId: "12345");

Delete secure mail by id

final client = M8tyClientSecuremails(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getSecureMailApi(); await api.deleteSecureMail(secureMailId: "12345");

Get secure mail attachment by id

final client = M8tyClientSecuremails(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getAttachmentsApi(); try { final Response<Uint8List> secureMailAttachment = await api.getSecureMailAttachmentById( secureMailId: "12345", attachmentId: "789", ); File file = File("/temp/myfile"); await file.writeAsBytes(secureMailAttachment.data!); } on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', ); }

Search for secure mails

final client = M8tyClientSecuremails(); client.setOAuthToken('ApiOAuth2', oauthToken); final api = client.getSecureMailApi(); SearchSecureMailRequestModel secureMailRequestModel = SearchSecureMailRequestModel((b) => b ..readStatus = ReadStatusModel.UNREAD ..customerId = "123" ..subject = "My message" ..dateSentFrom = DateTime.now().add(Duration(days: 5)), ); final Response<SecureMailPageModel> searchResult = await api.searchSecureMail( searchSecureMailRequestModel: secureMailRequestModel, );
03 June 2026