Results 1 to 8 of 8

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  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)

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.