mail_sender 0.0.3 mail_sender: ^0.0.3 copied to clipboard
A flutter plugin to send mail.
mail_sender #
- A Flutter plugin to send pre-filled emails from your Flutter app.
- Prefill the email's body, subject, recipients and more.
Features #
- Prefill the email's body, subject, recipients and more.
- Supports attachments.
Platform Support #
Android | iOS | MacOS | Web | Linux | Windows |
---|---|---|---|---|---|
✔️ | ✔️ |
Getting started #
Add the following to your pubspec.yaml
file:
dependencies:
mail_sender: ^version
Import the package:
import 'package:mail_sender/mail_sender.dart';
In your main.dart file, add the following code:
final _mailSenderPlugin = MailSender();
_mailSenderPlugin.sendMail(
recipient: ["john.Doe@gmail.com", "jane.doe@creoit.com"],
subject: "Leave Application",
body: "Some lengthy Body text",
bcc: ["bcc@bcc.com"],
cc: ["someGuy.promail@gmail.com", "msoffice@gmail.com"],
attachment: targetFile.path,
);
Android: Add the following to your AndroidManifest.xml
file:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
Create a new file provider_paths.xml
in android/app/src/main/res/xml
folder and add the following code:
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="app_flutter_files" path="../app_flutter/" />
</paths>
iOS: No configuration required.
Additional information #
Currently, the package is only tested on Android and iOS. If you want to use it on other platforms, please create an issue or contribute by creating a Pull request.
Currently, the package has some limitations, like it only supports single attachment, and iOS only supports adding PDF in attachments. We will add these features as well in the near future. If you want to add more features, please create an issue or contribute by creating a Pull request.
Use our example to get an idea of how to use the package. If you have any questions, please create an issue.
Future Plans #
- Add support for more file types in iOS.
- Add support for multiple attachments.
- Add support for more platforms.