Dave Mateer
Dave Mateer

Reputation: 17956

Send email with attachment using client's email application

I need my locally-installed, thick-client application (Qt / C++) to generate a ready-to-be-sent email message on the client's machine:

I have already tried:

Google Picasa achieves this (at least, on Windows; haven't checked other OS's) when you send pictures from within the application. It creates a message with the attachments and some pre-filled text. You can then edit the message and send at your convenience. Any ideas how they are doing this?

Upvotes: 12

Views: 6053

Answers (3)

Alexander Nassian
Alexander Nassian

Reputation: 517

Some time ago I've began to write a small library for opening the 'default email client' in a platform independent way. It still may need some work, but you can use it as a base if you want: https://github.com/picaschaf/qt-email

Upvotes: 1

Sujay Ghosh
Sujay Ghosh

Reputation: 2868

I dont think you are using the correct approach ; use MAPI / C++. I have done this several times both in Outlook / Thunderbird using MAPI/ C++ . You can choose the default email client by querying the registry ; I think thats what all applications do.

Also see the link here http://lists.trolltech.com/qt-interest/2006-02/thread00861-0.html

Upvotes: 4

Piotr Dobrogost
Piotr Dobrogost

Reputation: 42445

You could create an .eml file and open it which should give you the effect you want as long as there is any email client registered in the system to handle files with this extension. I'm sure this is not as universal as the mailto: scheme but if mailto: does not work for you I think this could be the second best option to try.

From http://www.coolutils.com/Formats/EML

Since EML files are created to comply with the industry RFC 822 standard, they can be used with most e-mail clients, servers and applications. Besides the Microsoft Outlook Express, EML files can be opened using most e-mail clients, such as Microsoft Outlook, Microsoft Entourage, Mozilla Thunderbird, Apple Mail, and IncrediMail.

Side note
When I click 'E-mail' in Picasa I get dialog where I can choose which application (Thunderbird or Google Mail) I want to send email with. This means Picasa knows specific email client being used to send email and can use custom method, specific to chosen email client, to send email. This is of course just speculation but it might be that Picasa makes user to choose email client because there's no generic way to do what you ask about.

Upvotes: 8

Related Questions