MailTo

Added in 1.5.0

class MailTo


MailTo URI parser. Replacement for android.net.MailTo.

This class parses a mailto scheme URI and then can be queried for the parsed parameters. This implements RFC 6068.

Note: scheme name matching is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your URI with the scheme using lower case letters, and normalize any URIs you receive from outside of Android to ensure the scheme is lower case.

Summary

Constants

const String!
MAILTO_SCHEME = "mailto:"

Public functions

String?

Retrieve the BCC address line from the parsed mailto URI.

String?

Retrieve the body line from the parsed mailto URI.

String?

Retrieve the CC address line from the parsed mailto URI.

(Mutable)Map<String!, String!>?

Retrieve all the parsed email headers from the mailto URI

String?

Retrieve the subject line from the parsed mailto URI.

String?

Retrieve the To address line from the parsed mailto URI.

java-static Boolean

Test to see if the given string is a mailto URI

java-static Boolean
isMailTo(uri: Uri?)

Test to see if the given Uri is a mailto URI

java-static MailTo
parse(uri: String)

Parse and decode a mailto scheme string.

java-static MailTo
parse(uri: Uri)

Parse and decode a mailto scheme Uri.

String

Constants

MAILTO_SCHEME

Added in 1.5.0
const val MAILTO_SCHEME = "mailto:": String!

Public functions

getBcc

Added in 1.5.0
fun getBcc(): String?

Retrieve the BCC address line from the parsed mailto URI. This could be several email address that are comma-space delimited. If no BCC line was specified, then null is return

Returns
String?

comma delimited email addresses or null

getBody

Added in 1.5.0
fun getBody(): String?

Retrieve the body line from the parsed mailto URI. If no body line was specified, then null is return

Returns
String?

body or null

getCc

Added in 1.5.0
fun getCc(): String?

Retrieve the CC address line from the parsed mailto URI. This could be several email address that are comma-space delimited. If no CC line was specified, then null is return

Returns
String?

comma delimited email addresses or null

getHeaders

Added in 1.5.0
fun getHeaders(): (Mutable)Map<String!, String!>?

Retrieve all the parsed email headers from the mailto URI

Returns
(Mutable)Map<String!, String!>?

map containing all parsed values

getSubject

Added in 1.5.0
fun getSubject(): String?

Retrieve the subject line from the parsed mailto URI. If no subject line was specified, then null is return

Returns
String?

subject or null

getTo

Added in 1.5.0
fun getTo(): String?

Retrieve the To address line from the parsed mailto URI. This could be several email address that are comma-space delimited. If no To line was specified, then null is return

Returns
String?

comma delimited email addresses or null

isMailTo

Added in 1.5.0
java-static fun isMailTo(uri: String?): Boolean

Test to see if the given string is a mailto URI

Note: scheme name matching is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your URI string with the scheme using lower case letters, and normalize any URIs you receive from outside of Android to ensure the scheme is lower case.

Parameters
uri: String?

string to be tested

Returns
Boolean

true if the string is a mailto URI

isMailTo

Added in 1.5.0
java-static fun isMailTo(uri: Uri?): Boolean

Test to see if the given Uri is a mailto URI

Note: scheme name matching is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your Uri with the scheme using lower case letters, and normalize any Uris you receive from outside of Android to ensure the scheme is lower case.

Parameters
uri: Uri?

Uri to be tested

Returns
Boolean

true if the Uri is a mailto URI

parse

Added in 1.5.0
java-static fun parse(uri: String): MailTo

Parse and decode a mailto scheme string. This parser implements RFC 6068. The returned object can be queried for the parsed parameters.

Note: scheme name matching is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your URI string with the scheme using lower case letters, and normalize any URIs you receive from outside of Android to ensure the scheme is lower case.

Parameters
uri: String

String containing a mailto URI

Returns
MailTo

MailTo object

Throws
androidx.core.net.ParseException

if the scheme is not a mailto URI

parse

Added in 1.5.0
java-static fun parse(uri: Uri): MailTo

Parse and decode a mailto scheme Uri. This parser implements RFC 6068. The returned object can be queried for the parsed parameters.

Note: scheme name matching is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your Uri with the scheme using lower case letters, and normalize any Uris you receive from outside of Android to ensure the scheme is lower case.

Parameters
uri: Uri

Uri containing a mailto URI

Returns
MailTo

MailTo object

Throws
androidx.core.net.ParseException

if the scheme is not a mailto URI

toString

fun toString(): String