Results 1 to 10 of 10

Thread: attaching file after opening default email client(Qt 4.4,Linux)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2011
    Posts
    9
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: attaching file after opening default email client(Qt 4.4,Linux)

    yes, it is not working on windows for me too.
    Any suggestions?

  2. #2
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: attaching file after opening default email client(Qt 4.4,Linux)

    Have you checked that l_string contains no spaces ? Not tested, but you could try this :

    Qt Code:
    1. 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 

  3. The following user says thank you to jpujolf for this useful post:

    avipachar (23rd February 2012)

  4. #3
    Join Date
    Nov 2011
    Posts
    9
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: attaching file after opening default email client(Qt 4.4,Linux)

    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

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: attaching file after opening default email client(Qt 4.4,Linux)

    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.

  6. The following user says thank you to ChrisW67 for this useful post:

    avipachar (24th February 2012)

  7. #5
    Join Date
    Aug 2012
    Posts
    4
    Qt products
    Platforms
    Windows

    Default Re: attaching file after opening default email client(Qt 4.4,Linux)

    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.

  8. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: attaching file after opening default email client(Qt 4.4,Linux)

    As explained above, you cannot reliably use mailto: links. You can try any of the Windows-specific methods;
    1. Simple Mapi (does not support HTML tags in the body)
    2. Extended Mapi (Does support HTML tags)
    3. CMC (Common Messaging Calls) Is a non-platform specific. When it is used on Windows it will access the MAPI properties.
    4. MAPI Activex
    5. CDO (Collaboration Data Objects).
    6. Automating Outlook
    7. and probably others

    I would guess that CDO is worth the most investigation.

Similar Threads

  1. Replies: 7
    Last Post: 5th January 2009, 08:27
  2. Opening swf file in the default browser
    By munna in forum Qt Programming
    Replies: 16
    Last Post: 5th May 2006, 09:33
  3. Opening the default mail client
    By munna in forum Newbie
    Replies: 5
    Last Post: 3rd April 2006, 13:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.