๐Ÿ“ง Email Sender

Pub Version License: MIT

โšก Now with HTML Support! Easily send rich HTML emails with full styling support directly from your Flutter app.

Email Sender Banner

GitHub

This is how your HTML email could look!

Email Sender is a powerful and lightweight Flutter package for integrating email functionality directly into your app. Whether it's sending basic emails, OTPs for verification, or beautifully formatted HTML messages โ€” this package has you covered.


๐Ÿ“ฆ Installation

Add the package using the Flutter CLI:

flutter pub add email_sender

Or manually add it to your pubspec.yaml:

dependencies:
  email_sender: ^2.0.1

Then run:

flutter pub get

๐Ÿš€ Features

  • โœ… Send plain emails
  • ๐Ÿ” OTP-based email verification
  • ๐Ÿ“ Custom messages (title, subject, body)
  • ๐Ÿ’ก Directly send raw HTML strings
  • ๐Ÿ“„ Send HTML templates (prebuilt or custom)
  • ๐Ÿ”‘ Use your own email credentials (e.g., Gmail App Password)
  • ๐Ÿ› ๏ธ Developer-friendly API with helper methods

๐Ÿงช Usage Examples

โœ… Initialization

EmailSender emailsender = EmailSender();

๐Ÿ“ค Send a Basic Email

var response = await emailsender.send("toemail@gmail.com");
print(response["message"]);

๐Ÿ” Send OTP

var response = await emailsender.sendOtp("toemail@gmail.com", 123456);

๐Ÿ“ Send Custom Message

var response = await emailsender.sendMessage(
  "toemail@gmail.com",
  "Your Title",
  "Your Subject",
  "Your message body here",
);

๐Ÿ’ก Send HTML String

var response = await emailsender.sendHtml(
  "toemail@gmail.com",
  "<h1>Welcome!</h1><p>This is an HTML email.</p>",
);

๐Ÿ“„ Send HTML Template

EmailSender htmlSender = EmailSender(
  "fromemail@gmail.com",
  "passkey",
  "toemail@gmail.com",
  "Template Title",
  "Template Subject",
  "<h1>HTML Body from Template</h1>"
);
var response = await htmlSender.customMessage();

๐Ÿ“– App Password Setup (Gmail)

If you're using Gmail, generate an app password to send emails securely.
๐Ÿ‘‰ Generate App Password


๐Ÿ“š Additional Resources


๐Ÿ‘จโ€๐Ÿ’ป Author

Shaik Afrid
๐Ÿ”— Portfolio


Libraries

email_sender