Switched to mailto parser

This commit is contained in:
M66B 2019-02-18 07:50:12 +00:00
parent 692b1e5ce2
commit f1b831ed23
1 changed files with 22 additions and 1 deletions

View File

@ -20,6 +20,7 @@ package eu.faircode.email;
*/
import android.content.Intent;
import android.net.MailTo;
import android.net.Uri;
import android.os.Bundle;
import android.text.Spanned;
@ -73,7 +74,10 @@ public class ActivityCompose extends ActivityBilling implements FragmentManager.
Uri uri = intent.getData();
if (uri != null && "mailto".equals(uri.getScheme())) {
String to = uri.getSchemeSpecificPart();
// https://www.ietf.org/rfc/rfc2368.txt
MailTo mailto = MailTo.parse(uri.toString());
String to = mailto.getTo();
if (to != null)
try {
InternetAddress.parse(to);
@ -81,6 +85,23 @@ public class ActivityCompose extends ActivityBilling implements FragmentManager.
} catch (AddressException ex) {
Log.w(ex);
}
String cc = mailto.getCc();
if (cc != null)
try {
InternetAddress.parse(cc);
args.putString("cc", cc);
} catch (AddressException ex) {
Log.w(ex);
}
String subject = mailto.getSubject();
if (subject != null)
args.putString("subject", subject);
String body = mailto.getBody();
if (body != null)
args.putString("body", body);
}
if (intent.hasExtra(Intent.EXTRA_EMAIL)) {