I want to make a Flutter app and one of the requirements is to open the native email client on the Android or iPhone device. I do NOT wish to create a new email, just open the email app. I would like to be able to open the email client with platform generic code if possible, if not I would like to know what would be required on the iOS side. I am not looking for the Send Email Intent, as I know there is a plugin in Flutter for that. Being a Android Developer I believe I know how to call an Intent from Flutter for that Implicit Intent, if I have to go that way, but I don't have the familiarity with iOS.
Open the default email client app with Flutter. Use the URL Launcher to launch an email within the default email app on your phone.
From the Home screen, tap the Apps icon (in the QuickTap bar) > the Apps tab (if necessary) > Email or tap the Email icon directly from the Home screen. The first time you open the Email app, a setup wizard opens to help you add an email account.
Yes, you can directly Send email from your app via SMTP using mailer plugin. You will need to ask and store user's Email, Password, SMTP port, and host and use these credentials to send emails.
The url_launcher plugin does that
mailto:<email address>?subject=<subject>&body=<body>
Create email to in the default email app
See also How do I open a web browser (URL) from my Flutter code?
You need two plugins: android_intent
and url_launcher
if (Platform.isAndroid) {
AndroidIntent intent = AndroidIntent(
action: 'android.intent.action.MAIN',
category: 'android.intent.category.APP_EMAIL',
);
intent.launch().catchError((e) {
;
});
} else if (Platform.isIOS) {
launch("message://").catchError((e){
;
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With