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.
13 Answers
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?

- 623,577
- 216
- 2,003
- 1,567
-
28I don't want to create a new email, I just want to open the default email app. – Peter Birdsall Jun 29 '18 at 17:35
-
Sorry, don't know about that – Günter Zöchbauer Jun 29 '18 at 17:37
-
1Try `message:` instead of `mailto: ...` – Alejandro Iván Jul 04 '18 at 18:47
-
1You probably need to use `Uri.encodeFull('It is not ok')` or `Uri.encodeComponent('It isnot ok')` and pass the resulting value instead. – Günter Zöchbauer Dec 10 '18 at 06:57
-
@AlejandroIván is that just for iOS? – Volodymyr Bobyr Mar 10 '21 at 20:05
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){
;
});
}

- 1,189
- 14
- 17
-
5On Android, this will open the email app inside your app. To open it in a new window add: `flags: [Flag.FLAG_ACTIVITY_NEW_TASK]` – Gabriel Aguirre May 16 '21 at 19:06
-
-
5
use url_launcher plugin url_launcher
Future<void> _launched;
Future<void> _openUrl(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
Then for Phone
setState(() {
_launched = _openUrl('tel:${+917600896744}');
});
for email
setState(() {
_launched = _openUrl('mailto:${sejpalbhargav67@gmail.com}'');
});
Update July 2021
Add Following Lines in Manifest File
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>

- 1,352
- 16
- 23
launch("mailto:<email address>?subject=<subject>&body=<body>");
use url_launcher package

- 14,011
- 2
- 83
- 54
-
1`launch` is now deprecated. Now, you should use `launchUrl` and it doesn't take a String, it takes a Uri(), and I'm struggling with how to write that Uri correctly!... I've made it open in the browser by using `Uri.https()`, but not in the e-mail app... There is the `Uri(path: 'String_path')` but that String can't contain a colon, so I can't write "mailto:".... Help? – Karolina Hagegård Jun 30 '22 at 06:33
I'm using open_mail_app: ^0.4.5
for this, it works pretty well and it took 2 min to add it to my app:
// Android: Will open mail app or show native picker.
// iOS: Will open mail app if single mail app found.
var result = await OpenMailApp.openMailApp();
It shows all 3 of my email apps that I have installed on my android smartphone, but for some reason it also gives the option to open my paypal app, which could make users of my app think to be a bit sus.
The developer of open_mail_app has added a filter to filter out paypal, but it seems not to work:
/// Default filter list includes PayPal, since it implements the mailto: intent-filter
/// on Android, but the intention of this plugin is to provide
/// a utility for finding and opening apps dedicated to sending/receiving email.

- 1,591
- 2
- 15
- 54
U can use url_luncher:
await launchUrl(Uri.parse("mailto:email?subject=subject&body=body"))
& don't use launch as it's deprecated:
launch("mailto:<email address>?subject=<subject>&body=<body>");

- 1,874
- 3
- 17
- 32
In theory this line of code should resolve the problem
String email = 'yourEmail@domain.com';
String title = 'The subject';
String message = '';
await launch(mailto:$email?subject=$title&body=$message);
But for some reason the subject and body are ignored, and to solve this issue check out this answer, it should work smoothly for all required parameters.
the working code:
final Uri params = Uri(
scheme: 'mailto',
path: email,
query: 'subject=$title&body=$message',
);
var url = params.toString();
await launch(url);

- 2,356
- 20
- 21
-
-
I had to add another dependency to use lunchUrl method, but this answer worked thanks ! – Fakher Jun 15 '23 at 21:24
You can use email_launcher
Example
Email email = Email(
to: ['one@gmail.com,two@gmail.com'],
cc: ['foo@gmail.com'],
bcc: ['bar@gmail.com'],
subject: 'subject',
body: 'body'
);
await EmailLauncher.launch(email);

- 307
- 3
- 6
this answer may be the solution How to open default email app inbox in flutter?
void openEmailApp(BuildContext context){
try{
AppAvailability.launchApp(Platform.isIOS ? "message://" : "com.google.android.gm").then((_) {
print("App Email launched!");
}).catchError((err) {
Scaffold.of(context).showSnackBar(SnackBar(
content: Text("App Email not found!")
));
print(err);
});
} catch(e) {
Scaffold.of(context).showSnackBar(SnackBar(content: Text("Email App not found!")));
}
}

- 1,482
- 1
- 13
- 15
-
1AppAvailability is an outdated plugin, if you use this it will generate when you releasing the build . So please avoid using this plugin – scienticious Jun 07 '21 at 06:47
You can use this package to open mail app in a device,https://pub.dev/packages/open_mail_app

- 319
- 1
- 14
This is my solution to the above problem that is working now!
sendAnEmail(String email) async {
const title = "Need support!";
const message = "";
final Uri url = Uri(
scheme: 'mailto',
path: email,
query: 'subject=$title&body=$message',
);
await launchUrl(url);
}

- 33
- 7
This library solved it perfectly for me: https://pub.dev/packages/flutter_email_sender. The example is good and the api is simple and obvious.

- 568
- 1
- 6
- 19
-
-
2
-
@zkon , I'd recommend you edit your answer to include exactly how to open the email app without sending the email! Otherwise, your answer will get downvoted, because ppl believe (from reading the package documentation) that the package can only send emails. Reading the documentation also takes a lot more time than if you would just write the relevant code here! So that would be very helpful, since you apparently know it. – Karolina Hagegård Jun 30 '22 at 06:53
I was looking for a similar solution and I found this package Open_mail_app. You can read through the readme.md on how to use it in your app.
[I will update this answer soon]

- 29
- 6