yes, it is not working on windows for me too.
Any suggestions?
yes, it is not working on windows for me too.
Any suggestions?
Have you checked that l_string contains no spaces ? Not tested, but you could try this :
Qt Code:
QDesktopServices:openUrl(QUrl("mailto:test@test.com?subject=test&body="+l_string+"&attach=\"" + l_string + "\""));To copy to clipboard, switch view to plain text mode
avipachar (23rd February 2012)
Thanks for the suggestion.
But i am not ablw to attach a file even if i give the name of file.(VS2010)
Like this:
QDesktopServices:penUrl(QUrl("mailto:test@test.com?subject=test&bod y=hi&attach=agent_reporting.sln" ));
New mail is opened with subject and all but the file is not attached?
Please suggest why this is happening and what to do to attach the file?
Thanks
avinash
On the Linux machine it was working by accident and not design.
The file is not attached because the mailto URL scheme does not specify "attach" as a special header like "body". You may specify any header defined in RFC 822, which includes the only other header guaranteed to be supported... "subject". You could try building a mime encoded multi-part body and encoding that into the "body" along with Content-Type and MIME-Version headers. No guarantees though, because the headers are not guaranteed, and URLs generally have an implementation-defined upper limit on their size that is too small for a decent attachment.
Some Windows mail clients accept a non-standard "attachment" header.
Last edited by ChrisW67; 24th February 2012 at 06:52.
avipachar (24th February 2012)
So does anybody succeeded in attaching file to the mail in Windows?
Can I have sample code that is working in Windows for file attachment. As I am facing the same problem in Windows.
Thanks in advance.
As explained above, you cannot reliably use mailto: links. You can try any of the Windows-specific methods;
- Simple Mapi (does not support HTML tags in the body)
- Extended Mapi (Does support HTML tags)
- CMC (Common Messaging Calls) Is a non-platform specific. When it is used on Windows it will access the MAPI properties.
- MAPI Activex
- CDO (Collaboration Data Objects).
- Automating Outlook
- and probably others
I would guess that CDO is worth the most investigation.
Bookmarks