KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to launch mail client and paste an address for sending
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: March 23, 2001

If you have a field in a client record that contains an email address, you may want to put a button next to that field that opens up the user's default mail client and pastes the address into a new message.

The way to make this happen (although it does not really involve the clipboard) is to use the OPEN WEB URL command:

$vtURL:="mailto:"+[Client]email_address
OPEN WEB URL($vtURL)

This code will open the current default email program and place the contents of [Client]email_address into the "To:" field in a new message. You can even include an automatic subject or body as follows (if the mail client supports this feature):

$vtURL:="mailto:"+[Client]email_address+"?subject=Re:%20Invoice#"+[Invoice]ID_num
OPEN WEB URL($vtURL)

Note that spaces and other special characters must always be encoded with URL encoding as is the "%20" above (hex 20 is decimal 32, the ASCII code for a space).