m8ty_client_securemails
Secure Mail client to manage messages 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';
How to perform different tasks
Here some examples how the dart client can be used
Create a new secure mail
final client = new M8tyClientSecuremail().getSecureMailApi();
final Response<SecureMailModel> model = await client.createNewSecureMail(
subject: "My message",
content: "Here the content of my message",
);
Get secure mail by id
final Response<SecureMailModel> secureMail = await client.getSecureMailById(secureMailId: "12345");
Delete secure mail by id
await client.deleteSecureMail(secureMailId: "12345");
Get secure mail attachment by id
final Response<Uint8List> secureMailAttachment = await client.getSecureMailAttachmentById(
secureMailId: "12345",
attachmentId: "789",
);
File file = File("/temp/myfile");
await file.writeAsBytes(attachment.data!);
Search for secure mails
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 client.searchSecureMail(searchSecureMailRequestModel: secureMailRequestModel);
Last modified: 08 January 2025