smtp_service 0.0.2 copy "smtp_service: ^0.0.2" to clipboard
smtp_service: ^0.0.2 copied to clipboard

A minimal, pure Dart SMTP email sender for sending emails without any third-party packages.

SMTP (Simple Mail Transfer Protocol) #

A lightweight, pure Dart solution to send emails directly via SMTP without any third-party dependencies. Perfect for Flutter and Dart applications that need simple, programmatic email sending.

Use Exmaple #

import 'dart:io';
import 'package:smtp_service/smtp.dart';

void main() async {
  // 1️⃣ إنشاء الخدمة مع بيانات تسجيل الدخول
  final smtpService = SMTPService(
    username: "ahmed@gmail.com",
    password: "password",
  );

  // 2️⃣ إضافة المستلمين (Observers)
  smtpService.attach(
    Recipient("mostafa@gmail.com", RecipientType.to),
  );
  smtpService.attach(
    Recipient("mohamed@gmail.com", RecipientType.to),
  );

  // 3️⃣ إنشاء الإيميل نفسه 
  final email = EmailBuilder()
      .from(
        const MailAddress(
          address: "ahmed@gmail.com",
          name: "Ahmed Wael",
        ),
      )
      .subject("Test Email from Dart")
      .message("This is a simple test email sent using pure Dart SMTP service.")
      .build();

  // 4️⃣ إزالة أحد المستلمين قبل الإرسال
  smtpService.detach(
    Recipient("ahmedwael99104@gmail.com", RecipientType.to),
  );

  // 5️⃣ إرسال الإيميل
  print("📤 Sending email...");
  await smtpService.sendEmail(email);
  print("✅ Email sent successfully!");
}

Author #

Ahmed Wael

Flutter Developer

Passionate about building modern, scalable apps

GitHub: https://github.com/AhmedWaela #

0
likes
105
points
12
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A minimal, pure Dart SMTP email sender for sending emails without any third-party packages.

License

MIT (license)

Dependencies

flutter

More

Packages that depend on smtp_service