35 #include "mailserviceimpl.h"
39 #include "kmmessage.h"
40 #include "kmmsgpart.h"
42 #include <dcopobject.h>
50 MailServiceImpl::MailServiceImpl()
51 : DCOPObject(
"MailTransportServiceIface" )
55 bool MailServiceImpl::sendMessage(
const TQString& from,
const TQString& to,
56 const TQString& cc,
const TQString& bcc,
57 const TQString& subject,
const TQString& body,
58 const KURL::List& attachments )
60 if ( to.isEmpty() && cc.isEmpty() && bcc.isEmpty() )
68 if ( !from.isEmpty() ) msg->setFrom( from );
69 if ( !to.isEmpty() ) msg->setTo( to );
70 if ( !cc.isEmpty() ) msg->setCc( cc );
71 if ( !bcc.isEmpty() ) msg->setBcc( bcc );
72 if ( !subject.isEmpty() ) msg->setSubject( subject );
73 if ( !body.isEmpty() ) msg->
setBody( body.utf8() );
75 KMail::Composer * cWin = KMail::makeComposer( msg );
76 cWin->setCharset(
"", TRUE);
78 cWin->addAttachmentsAndSend(attachments,
"", 1);
82 bool MailServiceImpl::sendMessage(
const TQString& to,
83 const TQString& cc,
const TQString& bcc,
84 const TQString& subject,
const TQString& body,
85 const KURL::List& attachments )
87 kdDebug(5006) <<
"DCOP call MailTransportServiceIface bool sendMessage(TQString to,TQString cc,TQString bcc,TQString subject,TQString body,KURL::List attachments)" << endl;
88 kdDebug(5006) <<
"This DCOP call is deprecated. Use the corresponding DCOP call with the additional parameter TQString from instead." << endl;
89 return sendMessage( TQString(), to, cc, bcc, subject, body, attachments );
93 bool MailServiceImpl::sendMessage(
const TQString& from,
const TQString& to,
94 const TQString& cc,
const TQString& bcc,
95 const TQString& subject,
const TQString& body,
96 const TQByteArray& attachment )
98 if ( to.isEmpty() && cc.isEmpty() && bcc.isEmpty() )
106 if ( !from.isEmpty() ) msg->setFrom( from );
107 if ( !to.isEmpty() ) msg->setTo( to );
108 if ( !cc.isEmpty() ) msg->setCc( cc );
109 if ( !bcc.isEmpty() ) msg->setBcc( bcc );
110 if ( !subject.isEmpty() ) msg->setSubject( subject );
111 if ( !body.isEmpty() ) msg->
setBody( body.utf8() );
113 KMMessagePart *part =
new KMMessagePart;
114 part->setCteStr(
"base64" );
115 part->setBodyEncodedBinary( attachment );
118 KMail::Composer * cWin = KMail::makeComposer( msg );
119 cWin->setCharset(
"", TRUE);
124 bool MailServiceImpl::sendMessage(
const TQString& to,
125 const TQString& cc,
const TQString& bcc,
126 const TQString& subject,
const TQString& body,
127 const TQByteArray& attachment )
129 kdDebug(5006) <<
"DCOP call MailTransportServiceIface bool sendMessage(TQString to,TQString cc,TQString bcc,TQString subject,TQString body,TQByteArray attachment)" << endl;
130 kdDebug(5006) <<
"This DCOP call is deprecated. Use the corresponding DCOP call with the additional parameter TQString from instead." << endl;
131 return sendMessage( TQString(), to, cc, bcc, subject, body, attachment );
void setBody(const TQCString &aStr)
Set the message body.
void setCharset(const TQCString &charset, DwEntity *entity=0)
Sets the charset of the message or a subpart of the message.
void addBodyPart(const KMMessagePart *aPart)
Append a body part to the message.
void initHeader(uint identity=0)
Initialize header fields.