0

Our users have reported that the the links in our mails are not clickable in Apple's Mail App as they are just recognized as pure texts(underlined blue colored text). But links become clickable when the same mail is forwarded (in quoted text). This problem only occurs in Apple Mail App and not in any other third party mail apps like gmail etc. Any reason or fix for this? Are we missing something that Mail App needs specifically to be mentioned while creating links? Why Links become operational when the same email is forwarded? This happens on all iOS devices (tested on Ipads and Iphones)

Any additional information from our side can be provided on the same, if needed for better clarification.

Thank You

1 Answers1

-1

Are you sure you are adding link attribute to your mailTo: link text?

You may want to give it a try while setting mail content attributed text.

    let attrText = NSMutableAttributedString.init(string: "Email me")
    let mailLink = "mailTo:test@example.com"
    let url = NSURL.init(string: mailLink) as NSURL?
    attrText.addAttribute(NSAttributedStringKey.link, value: url ?? "", range: NSMakeRange(0, attrText.length))



    let documentAttributes = [NSAttributedString.DocumentAttributeKey.documentType : NSAttributedString.DocumentType.html]
    do {
        let htmlData = try! attrText.data(from: NSMakeRange(0, attrText.length), documentAttributes:documentAttributes)
        if let htmlString = String(data:htmlData, encoding:String.Encoding.utf8) {
            let messageVC = MFMailComposeViewController()
            messageVC.setMessageBody(htmlString, isHTML: true)
        }
    }
Nirav Bhatt
  • 6,940
  • 5
  • 45
  • 89