You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-14Lines changed: 17 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,38 +23,41 @@ Then run `dart pub get`.
23
23
24
24
## Features
25
25
26
-
***`HtEmailClient` Abstract Class:** Defines the core interface for email sending operations.
27
-
*`Future<void> sendOtpEmail({required String recipientEmail, required String otpCode})`: Sends a One-Time Password email. Implementations must handle underlying service errors and map them to standard `ht_shared` exceptions.
26
+
***`HtEmailClient` Abstract Class:** Defines a generic, provider-agnostic interface for sending transactional emails. This approach decouples application logic from email content and styling, which can be managed directly within your email service provider (e.g., SendGrid, AWS SES).
27
+
*`Future<void> sendTransactionalEmail({required String recipientEmail, required String templateId, required Map<String, dynamic> templateData})`: Sends an email using a pre-defined template. Implementations must handle underlying service errors and map them to standard `ht_shared` exceptions.
28
28
29
29
## Usage
30
30
31
-
This package only provides the abstract interface. You need a concrete implementation package that implements `HtEmailClient`.
31
+
This package only provides the abstract interface. You need a concrete implementation package (e.g., `ht_email_sendgrid`) that implements `HtEmailClient`.
32
32
33
33
In your backend application (e.g., Dart Frog), you would typically:
34
34
35
-
1. Depend on a concrete implementation package (e.g., `ht_email_client_smtp`).
36
-
2. Configure and provide an instance of the concrete client using dependency injection (e.g., Dart Frog's provider).
37
-
3. Inject `HtEmailClient` into your services or route handlers where email sending is required.
35
+
1. Depend on a concrete implementation package.
36
+
2. Configure and provide an instance of the concrete client using dependency injection.
37
+
3. Inject `HtEmailClient` into your services where email sending is required.
38
38
39
39
```dart
40
40
// Example (Conceptual - in a service or route handler)
0 commit comments