mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-15 08:29:24 +00:00
Switched to mailto parser
This commit is contained in:
parent
692b1e5ce2
commit
f1b831ed23
1 changed files with 22 additions and 1 deletions
|
@ -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)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue