I just figured here out how to open a pre-populated new email message window using c++ on Mac OS X via the "open" command. Unfortunately I couldn't get it to insert both a message body and a subject.
This code should open a new message with a recipient, a subject and a body filled in but it doesn't. Only the recipient and subject are filled in.
mailto:[email protected]?subject=Congrats%20Obama&body=Hello
If I remove the subject, it would successfully include the recipient and body such as in this code so the body itself doesn't seem to be incorrectly formatted.
mailto:[email protected]?body=Hello
Please let me know if you can figure out how to open a "new message" window with both a subject AND a body message.
The ampersand (&) is the culprit; everything before it executes in the background and body=...
executes separately.
Escape it with a backslash.
Since this is a C++ string, you also need to escape the backslash itself; \\&
.