Fix issues
This commit is contained in:
parent
1a380509fe
commit
3eb61e3107
2 changed files with 40 additions and 20 deletions
|
@ -1,5 +1,6 @@
|
|||
import "dart:io";
|
||||
import "package:enough_mail/enough_mail.dart";
|
||||
import "package:markdown/markdown.dart";
|
||||
import "package:nexusbot/controllers/settings_controller.dart";
|
||||
import "package:riverpod/riverpod.dart";
|
||||
|
||||
|
@ -20,6 +21,25 @@ class MailClientController extends AsyncNotifier<MailClient> {
|
|||
return client;
|
||||
}
|
||||
|
||||
Future<void> sendMessage({
|
||||
required String plainText,
|
||||
required String markdown,
|
||||
required String subject,
|
||||
required MailAddress from,
|
||||
required MailAddress to,
|
||||
}) async {
|
||||
final client = await future;
|
||||
return await client.sendMessageBuilder(
|
||||
MessageBuilder.prepareMultipartAlternativeMessage(
|
||||
plainText: plainText,
|
||||
htmlText: markdownToHtml(markdown),
|
||||
)
|
||||
..subject = subject
|
||||
..from = [from]
|
||||
..to = [to],
|
||||
);
|
||||
}
|
||||
|
||||
static final provider =
|
||||
AsyncNotifierProvider<MailClientController, MailClient>(
|
||||
MailClientController.new,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue