Just wanted to record this here for posterity. Out of the box, HTMLViewer on the Mac does nothing with mailto: URLs.

Until REAL Software fixes this, you can mostly get by as follows:

In your HtmlViewer.CancelLoad Event Handler, do this:

  #If TargetMacOS
    If URL.StartsWith("mailto:";) Then
      URL = LTrim(URL.Mid(8))
      Dim firstSplit() As String = URL.Split("?")
      Dim toAddress As String = firstSplit(0)
      Dim subject As String = ""
      Dim body As String = ""
      If UBound(firstSplit) > 0 Then
        Dim secondSplit() As String = firstSplit(1).Split("&")
        For Each s As String In secondSplit
          If s.Left(8) = "subject=" Then
            subject = s.Mid(9)
          ElseIf s.Left(5) = "body=" Then
            body = s.Mid(6)
          End If
        Next
      End If
      createEmail(toAddress, subject, body)
      Return True
    End If
  #endif

Create an Applescript like so:

on run {recipientAddress, theSubject, theBody}
        tell application "Mail"
                set newMessage to make new outgoing message
                tell newMessage
                        set visible to true
                        if (recipientAddress is not equal to "") then
make new recipient at end of to recipients with properties {address:recipientAddress}
                        end if
                        if theSubject is not equal to "" then
                                set subject to theSubject
                        end if
                        if theBody is not equal to "" then
                                set content to theBody
                        end if
                end tell
        end tell
end run

Save it (run only) as createEmail, and drag that into your project.

If you're really excited, you could get this to parse all possible mailto: arguments, or do this in some cleverer way. But the above works for recipient, subject and body.

Guyren G Howe
guyren-at-relevantlogic.com
http://relevantlogic.com

REALbasic, PHP, Python programming
PostgreSQL, MySQL database design and consulting
Technical writing and training


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to