Open Mail application from a Form with a PushButtonObject

I’ve been trying to replicate James Cook’s full featured and fantastic Contacts Form from InView. My version is very simple compared to the robust functionality of his original but I would like to retain some of the basic routines of that database.

I have an Email field and a URL field. I want to have a PushButtonObject that takes the email address from the Email field and then opens up my Mail application with the address filled in. I can’t quite seem to get the Procedure right to make this happen.

I know with the URL field I can use the Procedure openURL URL to make the Button open Safari and go directly to the webpage.

I realize it’s got to be an easy solution but as I’m not a programmer in real life I haven’t been able to figure it out.

Screen shot of Form I’m working on:

The code for the Push Button Object would use the openurl statement.

If you have the current Email in a variable (theEmailAddress in my example) you would use this code:

openurl "mailto:"+theEmailAddress

Note: the Help docs say you can include a subject by following the above formula with a “?” and the Subject text but this does not work for me and the subject is ignored.

Thanks Gary. That worked perfectly.