Results 1 to 8 of 8

Thread: [Qxt] Ho to send attachment with html message ?

  1. #1
    Join Date
    Dec 2010
    Location
    Tunisia
    Posts
    21
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [Qxt] Ho to send attachment with html message ?

    Hi,

    i tried to use qxt to send mails through smtp. I succeed to send html mails and plain text mails with attachment but when i try to send html mails with attachments i receive a message like this :

    This is a message with multiple parts in MIME format.
    --0d51120e-3412-43ca-9171-655ece0d0011
    Content-Type: text/html

    <html><body><h1 style="text-align: center;">Safe Systems</h1></body></html>
    --0d51120e-3412-43ca-9171-655ece0d0011
    Content-Disposition: attachment; filename=flyer1.png
    Content-Type: image/png
    Content-Transfer-Encoding: base64

    iVBORw0KGgoAAAANSUhEUgAAAb0AAAKYCAYAAADnpyZcAAAAAX NSR0IArs4c6QAAAAZiS0dEAP8A..........
    this is my script :

    Qt Code:
    1. QFile flyer("flyer1.png");
    2. flyer.open(QIODevice::ReadOnly);
    3. QxtMailAttachment *attachment = new QxtMailAttachment(flyer.readAll(),QString("image/png"));
    4.  
    5. QxtMailMessage *message = new QxtMailMessage;
    6. message->setSender("Sender Mail <xxx@xxx.tn>");
    7. message->setExtraHeader("Reply-To","xxx@xxx.fr");
    8. message->addRecipient("xcv@qsd.com");
    9. message->setSubject("Test subject.");
    10.  
    11. message->setExtraHeader("Content-Type","text/html");
    12. message->setBody(QByteArray("<html><body><h1 style=\"text-align: center;\">Test Mail</h1></body></html>"));
    13.  
    14. message->setExtraHeader("MIME-Version","1.0");
    15. message->addAttachment("flyer1.png",*attachment);
    16.  
    17. QxtSmtp *smtp = new QxtSmtp;
    18. smtp->connectToHost("smtp.xx.yy");
    19. smtp->send(*message);
    To copy to clipboard, switch view to plain text mode 

    How can i fix this ?

    Thanks.

  2. The following user says thank you to slimittn for this useful post:

    Morion_self (18th June 2011)

  3. #2
    Join Date
    Apr 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [Qxt] Ho to send attachment with html message ?

    Hi!
    This works fine with *jpg files - look for you content type...

  4. #3
    Join Date
    Jun 2011
    Location
    Russia, Tyumen
    Posts
    3
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: [Qxt] Ho to send attachment with html message ?

    Hi!

    Why I get error messages (like this: undefined reference to `QxtMailMessage::QxtMailMessage()') in this part of code:
    Qt Code:
    1. QxtMailMessage *message = new QxtMailMessage;
    To copy to clipboard, switch view to plain text mode 

    I write in my h-file
    Qt Code:
    1. #include <QxtNetwork/qxtsmtp.h>
    2. #include <QxtNetwork/qxtmailmessage.h>
    To copy to clipboard, switch view to plain text mode 

    I use Qt Creator 2.0.1, if it is important
    Last edited by Morion_self; 18th June 2011 at 22:21. Reason: error in code

  5. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: [Qxt] Ho to send attachment with html message ?

    Sounds like a linker error. I've never used Qxt, but probably you'll need to add -lqxt or something like that to compilation options ( check Qxt webpage or README for details ).

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

    Morion_self (18th June 2011)

  7. #5
    Join Date
    Jun 2011
    Location
    Russia, Tyumen
    Posts
    3
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: [Qxt] Ho to send attachment with html message ?

    No, not at the site or in the readme is nothing like that

    P.S. I think, I must write
    Qt Code:
    1. #include <QxtMailMessage>
    To copy to clipboard, switch view to plain text mode 
    but if I do it, I get error: QxtMailMessage: No such file or directory
    Last edited by Morion_self; 18th June 2011 at 22:42.

  8. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,316
    Thanks
    314
    Thanked 870 Times in 857 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: [Qxt] Ho to send attachment with html message ?

    An "undefined reference" is a linker error not a compile error. It has absolutely nothing to do with header files. It means that you have not specified the library that contains the QxtMailMessage object code during the linking of your program.

  9. The following user says thank you to d_stranz for this useful post:

    Morion_self (18th June 2011)

  10. #7
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: [Qxt] Ho to send attachment with html message ?

    Here is Qxt User Guide, there is "Using Qxt in your project" section.

  11. The following user says thank you to stampede for this useful post:

    Morion_self (18th June 2011)

  12. #8
    Join Date
    Jun 2011
    Location
    Russia, Tyumen
    Posts
    3
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: [Qxt] Ho to send attachment with html message ?

    Oh, thanks...

    I used only
    QXT += core gui
    as an example.. bad English =))

Similar Threads

  1. how do i send message by ÙŽ QxtSmtp ??
    By alabdaly in forum Newbie
    Replies: 6
    Last Post: 12th July 2010, 12:28
  2. I need to send a message to parent dialog
    By santhoshv84 in forum Qt Programming
    Replies: 1
    Last Post: 3rd July 2008, 11:16
  3. Send TCP message
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 5th June 2008, 09:33
  4. How to send message to Desktop Widget
    By shyam prasad in forum Qt Programming
    Replies: 18
    Last Post: 18th April 2007, 11:00
  5. Replies: 3
    Last Post: 6th February 2006, 17:41

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.