+ // Use an external email program if the link begins with "mailto:".
+ if (url.startsWith("mailto:")) {
+ // We use `ACTION_SENDTO` instead of `ACTION_SEND` so that only email programs are launched.
+ Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
+
+ // Parse the url and set it as the data for the `Intent`.
+ emailIntent.setData(Uri.parse(url));
+
+ // `FLAG_ACTIVITY_NEW_TASK` opens the email program in a new task instead as part of Privacy Browser.
+ emailIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+ // Make it so.
+ startActivity(emailIntent);
+ return true;
+ } else { // Load the URL in Privacy Browser.
+ mainWebView.loadUrl(url);
+ return true;
+ }