view method
Renders a view template for the email body.
The view is rendered using the Khadem view system.
Example:
await mailer.view('emails.welcome', {'name': 'John'});
Implementation
@override
Future<MailerInterface> view(
String viewName, [
Map<String, dynamic>? data,
]) async {
final renderer = ViewRenderer.instance;
final htmlContent = await renderer.render(
viewName,
context: data ?? {},
);
_message.setHtmlBody(htmlContent);
// Also set text body as stripped HTML (basic implementation)
final textContent = _stripHtmlTags(htmlContent);
_message.setTextBody(textContent);
return this;
}