Open default mail app from within Qt with some html

Vin*_*rez 1 html c++ email qt

How can I open the default compose mail window from the user's mail app from within a Qt app?

I found there is some class for mobile with Qtmobility, but I don't have access to this class as I'm working on a desktop app.

I also found people to use a URL sheme with a mailto in it. This isn't working for me because the html is stripped at some point, probably because of the url being too long and the html is not rendered in html but in plain text.

如何在Qt中预先编写邮件并打开默认邮件应用程序?

doc*_*eer 5

Qt中没有内置的方式来发送HTML格式的电子邮件。Mailto方法适用于未格式化的文本,例如

QDesktopServices::openUrl(QUrl("mailto:?to=recipient@example.com&subject=The subject of an email&body=Here is some email body text", QUrl::TolerantMode));
Run Code Online (Sandbox Code Playgroud)

但这不能用于 html格式的文本。

如果您绝对需要HTML,则需要查看平台的选项: