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

This plugin in to open mail and send mail with different cases

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
  }

  void _openEmailApp() async {
    try {
      await FlutterEmailer.openEmailApp();
    } catch (e) {
      debugPrint('Error: $e');
    }
  }
  void _openEmailWithSubject() async {
    try {
      await FlutterEmailer.openEmailWithForSingleReceiverWithSubject('receiverEmail@gmail.com',"Test Subject");
    } catch (e) {
      debugPrint('Error: $e');
    }
  }

  void _openEmailWithForSingleReceiverOnly() async {
    try {
      await FlutterEmailer.openEmailWithForSingleReceiverOnly("receiverEmail@gmail.com");
    } catch (e) {
      debugPrint('Error: $e');
    }
  }

  void _openEmailWithForMultipleReceiverOnly() async {
    try {
      await FlutterEmailer.openEmailWithForMultipleReceiverOnly(["receiverEmail@gmail.com","receiverEmail2@gmail.com"]);
    } catch (e) {
      debugPrint('Error: $e');
    }
  }

  void _openEmailWithForMultipleReceiverWithSubject() async {
    try {
      await FlutterEmailer.openEmailWithForMultipleReceiverWithSubject(["receiverEmail@gmail.com","receiverEmail2@gmail.com"],"Multiple receiver subject");
    } catch (e) {
      debugPrint('Error: $e');
    }
  }

  void _shareEmailWithBody() async {
    try {
      await FlutterEmailer.openEmailWithBodyOnly('This is the body of the email.');
    } catch (e) {
      debugPrint('Error: $e');
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Emailer Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home:  Scaffold(
        appBar: AppBar(
          title: const Text('Flutter Emailer Example'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              ElevatedButton(
                onPressed: _openEmailApp,
                child: const Text('Open Email App'),
              ),
              ElevatedButton(
                onPressed: _openEmailWithSubject,
                child: const Text('Open Email with Specific Subject'),
              ),
              ElevatedButton(
                onPressed: _openEmailWithForSingleReceiverOnly,
                child: const Text('Open Email with single receiver'),
              ),
              ElevatedButton(
                onPressed: _openEmailWithForMultipleReceiverOnly,
                child: const Text('Open Email with multiple receiver'),
              ),
              ElevatedButton(
                onPressed: _openEmailWithForMultipleReceiverWithSubject,
                child: const Text('Open Email with multiple receiver with subject'),
              ),
              ElevatedButton(
                onPressed: _shareEmailWithBody,
                child: const Text('Share Email with Body Only'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
3
likes
0
points
36
downloads

Publisher

verified publisherfermioninfotech.com

Weekly Downloads

This plugin in to open mail and send mail with different cases

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface, url_launcher

More

Packages that depend on flutter_emailer