BoraMailer is a Dart class designed to simplify the process of sending emails through a remote service. This class leverages the power of the http package to communicate with the designated email API.

Features

Email Composition: Easily compose emails with customizable parameters such as recipient, sender, subject, and body.
Attachment Support: Attach files to your email, including base64-encoded content, and seamlessly include them in the email body.

Usage


import 'package:ilebora_mailer/bora_mailer.dart';

void main() async {
  // Initialize BoraMailer
  final boraMailer = BoraMailer(
    userID: 'your_user_id',
    apiKey: 'your_api_key',
    to: 'recipient@example.com',
    from: 'sender@example.com',
    subject: 'Sample Email Subject',
    body: 'Hello, this is the email body!',
    title: 'Email Title',
  );

  // Add Attachment (optional)
  boraMailer.addAttachment('path/to/attachment.pdf');

  // Send Email
  final response = await boraMailer.sendRemote();

  if (response != null) {
    print('Email Sent successfully. Response: ${response.body}');
  } else {
    print('Error Sending Email: ${boraMailer.error}');
  }
}

API Reference

BoraMailer Class

  • Constructors

    BoraMailer({required userID, required apiKey, required to, required from, required subject, required body, required title}): Initialize the BoraMailer instance with essential parameters.

  • Methods

    addAttachment(String file): Attach a file to the email.

    sendRemote(): Send the email to the remote email API.

License

This project is licensed under the MIT License - see the LICENSE file for details.