[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 :
Quote:
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 :
Code:
QFile flyer
("flyer1.png");
QxtMailAttachment
*attachment
= new QxtMailAttachment
(flyer.
readAll(),
QString("image/png"));
QxtMailMessage *message = new QxtMailMessage;
message->setSender("Sender Mail <xxx@xxx.tn>");
message->setExtraHeader("Reply-To","xxx@xxx.fr");
message->addRecipient("xcv@qsd.com");
message->setSubject("Test subject.");
message->setExtraHeader("Content-Type","text/html");
message
->setBody
(QByteArray("<html><body><h1 style=\"text-align: center;\">Test Mail</h1></body></html>"));
message->setExtraHeader("MIME-Version","1.0");
message->addAttachment("flyer1.png",*attachment);
QxtSmtp *smtp = new QxtSmtp;
smtp->connectToHost("smtp.xx.yy");
smtp->send(*message);
How can i fix this ?
Thanks.
Re: [Qxt] Ho to send attachment with html message ?
Hi!
This works fine with *jpg files - look for you content type...
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:
Code:
QxtMailMessage *message = new QxtMailMessage;
I write in my h-file
Code:
#include <QxtNetwork/qxtsmtp.h>
#include <QxtNetwork/qxtmailmessage.h>
I use Qt Creator 2.0.1, if it is important
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 ).
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
Code:
#include <QxtMailMessage>
but if I do it, I get error: QxtMailMessage: No such file or directory
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.
Re: [Qxt] Ho to send attachment with html message ?
Here is Qxt User Guide, there is "Using Qxt in your project" section.
Re: [Qxt] Ho to send attachment with html message ?
Oh, thanks...
I used only
QXT += core gui
as an example.. bad English =))