This is a very old question, but it seems that no answer was found because it was asked at the moment (xCode 7 OSX 10.11), the problem is still present.
The solution I found is a bit hacky, but it simplifies and works (with mail.app), so I decided that it can help people in the future.
Instead of using the NSAttributed string, I encoded a variable containing HTML text in a fake URL. This makes mail.app treat it as an attachment, and I found that it shows its contents in the html <a> , as if it were an internal hyperlink.
Here is the code I used (in Swift):
var eMailService:NSSharingService! = NSSharingService(named:NSSharingServiceNameComposeEmail) eMailService.subject = mySubject let message = "<html><body>Message body ...</body></html>" let embeddedMessage = "</a>" + message if let encodedMessage = embeddedMessage.stringByAddingPercentEncodingWithAllowedCharacters (NSCharacterSet.alphanumericCharacterSet()), let urlMessage = NSURL(string:encodedMessage)! { eMailService.performWithItems([urlMessage]) }
Note1: the β/ aβ tag that I insert at the beginning of my inline message is designed to prevent the entire html content from being selected as a hyperlink (since mail.app puts my URL in the βaβ tag, I just close it there).
Note2: this causes the NSSharingService to complain that the URL is not absolute (in the log), but it still correctly inserts it into the email. I can turn off this error by adding βdata:β before my inserted β/ aβ tag, but then βe-mailβ appears in the email (which I didn't like).
source share