Question

I've searched around for a bit, but haven't been able to find anything useful on this.

How do browsers communicate with email programs, such as Thunderbird and Outlook (on the Mac, if that's relevant)?

By communicate, I mean the process it goes through to create a new email window with a designated to address, subject, body, through the mailto: link. How does the browser let the email program know what to put for each field? Using the command line (for Thunderbird, at least) didn't make much sense, as that opens a brand new instance of Thunderbird on the Mac.

I haven't found any sort of API for this, so if someone can point me in the right direction, that would be greatly appreciated. Thanks!

Was it helpful?

Solution

On windows, the browser use the "default" email client defined by the system.

It's stored in the Windows registry and define the command line to open the mail program. You can find more info and an exemple on the Microsoft website.

http://msdn.microsoft.com/en-us/library/windows/desktop/cc144109%28v=vs.85%29.aspx#sample_mail_program

If I look in my registry for thunderbird, It seems to execute:

 "C:\Program Files\Mozilla Thunderbird\thunderbird.exe" -osint -compose "%1"

I have no idea how it works for the mac!

OTHER TIPS

the additional information sent to the mail client is usually (from what i have seen) tacked onto the back of the mailto command.

in the following example, the client should automatically fill in the subject as 'greetings from stackoverflow'

mailto:hello@example.com?subject=greetings from stackoverflow

i have listed the other commands i know of below:

to edit subject: ?subject=
to edit cc: ?cc=
to edit bcc: ?bcc=
to edit body content: ?body=

these can also be used together by placing them after eachother and swapping the '?' for a '&', example

mailto:hello@example.com?subject=hello there&body=goodbye

this should create an email with the subject of 'hello there' and a body message of 'goodbye'

i hope this helps!

A very useful oldies that explains the surface called RCDefault

It shows you that the Finder or the Browser uses (can use) URLs to call other applications.

I am attaching the screenshot for the Mail application on OSX here:

mail application url schemes

The OS will then call this application with the URL (or file) and the application is supposed to understand how to open that URL. The URL scheme for the mailto protocol for apple, is here

You should be able to find other schemes for the application you need to use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top