smtpman 1.0.3 copy "smtpman: ^1.0.3" to clipboard
smtpman: ^1.0.3 copied to clipboard

A Fast & Light SMTP Mail sender, with authentication support.

example/example.md

Here the example of all method, enjoy coding 😃

import 'package:flutter/material.dart';
import 'package:smtpman/port.dart';
import 'package:smtpman/secure.dart';
import 'package:smtpman/smtpman.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Home(),
    );
  }
}

class Home extends StatelessWidget {
  const Home({Key? key}) : super(key: key);
  sendMyMail() async {
    SmtpMan smtpman = SmtpMan();
    smtpman.setServer(
      host: "smtp.rohitchouhan.com",
      username: "hello@crohitchouhan.com",
      password: "<<password>>",
      authentication: true,
      port: Port.to_587,
      secure: Secure.starttls,
    );

    smtpman.receipt(
      senderName: "Rohit Team",
      sendToEmail: "itsrohitofficial@gmail.com",
      subject: "How are you....",
      body: "Hey, <b>Bro</b>",
      html: true,
    );

    if (await smtpman.send() == true) {
      debugPrint("Email has been sent!");
    } else {
      debugPrint("Faild to send, please check smtp credential.");
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
            onPressed: () async {
              await sendMyMail();
            },
            child: const Text("Send Mail")),
      ),
    );
  }
}
12
likes
130
pub points
3%
popularity

Publisher

verified publisherrohitchouhan.com

A Fast & Light SMTP Mail sender, with authentication support.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, http

More

Packages that depend on smtpman