September 24, 2010

qwertyuiopearendil qwertyuiopea..
Lab Rat
61 posts

Attaching file in Windows

 

Hi to all, i’d like to know if someone know how can i send an email with the default email client with attachement.
I’ve tryed this code:

  1. QString fileName="C:\\myfile.png";
  2. QDesktopServices::openUrl(QUrl("mailto:?subject=Prova &body=bodybodybody &attach="+fileName));

Into the definition of fileName there’s only 1 slash even if you’ll see 4

Thanks.

4 replies

September 24, 2010

iunknwn iunknwn
Lab Rat
33 posts

Try following variations:

&attachment or &attachments instead of &attach. These are some variations I saw with quick googling. Also, original mailto rfc document doesn’t have any notion of attachments. Those were added later as a part of MIME extentions.

 Signature 

Vista x64 with Qt 4.8.2 and VS2010

September 24, 2010

qwertyuiopearendil qwertyuiopea..
Lab Rat
61 posts

It doesn’t run.

If would be possible find another solution even mailto should be ok for me.

September 24, 2010

stuk stuk
Ant Farmer
523 posts

In thunderbird you can use the command line :

thunderbird -compose “to=asd@asd,subject=Prova,body=bodybodybody,attachment=‘file:///C:/logfile.log’”

Link… [kb.mozillazine.org])

April 16, 2013

gogoud gogoud
Lab Rat
1 posts

stuk’s tip was very helpful for me – thanks to stuk!

 
  ‹‹ Using QThread      BigDecimal? ››

You must log in to post a reply. Not a member yet? Register here!