๐ง Email Sender
โก Now with HTML Support! Easily send rich HTML emails with full styling support directly from your Flutter app.
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