iphone – How to send feedback email using malto in compose multiplatform in iOS part?


I’ve been struggling with sending feedback email. I tried the expect actual concept as I didn’t find any trustworthy library for the task.

In the android section its fine using the below code:

val body = """
 ----------start-----------------
 Please don't remove this information
 Info............
 -----------end-----------------
 """
    val intent = Intent(Intent.ACTION_VIEW, Uri.parse("mailto:"))
    intent.putExtra(
        Intent.EXTRA_EMAIL,
        arrayOf("[email protected]")
    )
    intent.putExtra(
        Intent.EXTRA_SUBJECT,
        "app-issue"
    )
    intent.putExtra(Intent.EXTRA_TEXT, body)
    startActivity(LocalContext.current,intent,null)

But in the iOS part, I’ve done such but I didn’t have any present method in the ios.kt file.


if (MFMailComposeViewController.canSendMail()) {
        val  mail = MFMailComposeViewController()
        mail.setToRecipients(listOf("[email protected]"))
        mail.setSubject("app-issue")

        val deviceInfo = """
    ----------start-----------------
    Please don't remove this information
    Info......
    -----------end-----------------
    """

        mail.setMessageBody(deviceInfo, isHTML = false)

    } else {
        // show failure alert
    }

So how to open the default mail client in the iOS platform with these informations.

I also looked up at this code but URLComponents are not also referenced in the class.

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img