PDA

View Full Version : Adding an Attachment to an email, using QDEsktopServices



dan3460
12th September 2017, 18:12
I have a very simple application to test the email service.

ui->setupUi(this);
QString fileName=QFileDialog::getOpenFileName(this,"Attach File");
qDebug()<<fileName;
QDesktopServices::openUrl(QUrl("mailto:recipient@example.com?subject=Test&body=This is the body&Attach="+fileName));
I want to attach a file to the email. When i run the application the email opens but there is no attachment. The application output show a bunch of messages from a process called ShellStreams and the last message of the list is ShellStreams: Detach and the file name that i tried to attach. If i'm in other application, lets say PDF, i can attach files to the email popup. I looked on line but most of the answers where for linux. Any idea how to solve this?
Here is the output from my program:

ShellStreams: Attach
ShellStreams: InitializedTrying to load localized resources for LANGID 1033 with Primary LANGID 9 code en name English (Universal)Resource DLL loaded at path C:\Program Files (x86)\Common Files\Apple\Internet Services\ShellStreams.resources\en.lproj\ShellStre amsLocalized.dllNot running under explorer. Will not set thread locale5860 1EA84CC0 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1EA84CC0 ENTER: ShellStreamsFolder::CreateViewObject
5860 1EAA48E0 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1EAA48E0 ENTER: ShellStreamsFolder::CreateViewObject
5860 1EAA45E0 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1EAA45E0 ENTER: ShellStreamsFolder::CreateViewObject
5860 1EAA4FA0 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1EAA4FA0 ENTER: ShellStreamsFolder::CreateViewObject
5860 1EAA4640 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1EAA4640 ENTER: ShellStreamsFolder::CreateViewObject
5860 1EAA5000 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1EAA5000 ENTER: ShellStreamsFolder::CreateViewObject
5860 1EAA50C0 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1EAA50C0 ENTER: ShellStreamsFolder::CreateViewObject
5860 1E8C5E98 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1E8C5E98 ENTER: ShellStreamsFolder::CreateViewObject
5860 1E8C6618 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1E8C6618 ENTER: ShellStreamsFolder::CreateViewObject
5860 1E8C62B8 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 1E8C62B8 ENTER: ShellStreamsFolder::CreateViewObject
5860 1E8C67F8 ENTER: ShellStreamsFolder::ShellStreamsFolder
pidl = 1f50e04fd020ea3a6910a2d8802b30309d140 -> 2e80853fd6f0ec379740b3d61b4a891711800 ->
5860 00000000 ENTER: DllCanUnloadNow
ShellStreams: Detach"C:/Users/dkolb/Documents/Develop/Test/Test1/build-TestMailPDF-Desktop_Qt_5_9_1_MinGW_32bit-Debug/FSMA.pdf"