Features

The main feature of this library is to help people send emails while using the flutter app without having to use any third-party native apps.. this sends the email directly to the provided email in the function declaration

Getting started

To get started with the package all that simply needs to be done is to add the dependency name to your flutter project's "pubspec.yaml" file.

Usage


import 'package:flutter/material.dart';
import 'package:flutter_mail_server/flutter_mail_server.dart';

class MailApp extends StatelessWidget {
  TextEditingController name = TextEditingController();
  TextEditingController email = TextEditingController();
  TextEditingController emailmessage = TextEditingController();

  MailApp({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: const Text("Mail app"),
      ),
      body: SafeArea(
        child: Column(
          children: [
            TextFormField(
              controller: name,
              decoration: const InputDecoration(
                hintText: "Username",
              ),
            ),
            TextFormField(
              controller: email,
              decoration: const InputDecoration(
                hintText: "Email",
              ),
            ),
            TextFormField(
              controller: emailmessage,
              decoration: const InputDecoration(
                hintText: "Message",
              ),
            ),
            ElevatedButton(
              onPressed: () {
                Mailer().sendEmail(
                  // user side
                  name.text,
                  email.text,
                  emailmessage.text,

                  // company email and CC:
                  "youremail@gmail.com",
                  "yourDomainEmail@yourDomainName.whateverDNSyouUse",

                  // error message
                  const AlertDialog(
                    title: Text("Message"),
                    content: Text(
                      "failed to send email",
                      style: TextStyle(
                        color: Colors.red,
                      ),
                    ),
                  ),

                  // success message
                  const AlertDialog(
                    title: Text("Message"),
                    content: Text(
                      "email sent successfuly",
                      style: TextStyle(
                        color: Colors.green,
                      ),
                    ),
                  ),
                );
              },
              child: Row(
                children: const [Text("Send email")],
              ),
            )
          ],
        ),
      ),
    );
  }
}


Additional information

NOTE: "THE VERSION 0.0.1 is deprecated due to unconfigured server issues"...

Fill in all the parameters to get started with the project