Sending mail with KMail using DBus
Stefano Crocco
posta at stefanocrocco.it
Thu Apr 9 19:44:16 BST 2020
Hello to everyone,
I'm trying to write a script which uses KMail to send automatically generated
mails to several people using DBus. I used QDBusViewer to find out which
methods KMail provides and I saw a sendMessage method which takes the various
fields of the mail (From, To, ...) as parameters and sends the mail. I tried
using it from QDBusViewer and it worked correctly. However, when I try to call
it from the command line using qdbus, it doesn't send the mail.
The command I use is:
qdbus org.kde.kmail2 /MailTransportService
org.kde.mailtransport.service.sendMessage xxxxx at xxx.it yyyyyy at yyy.it "" ""
test Test ""
This call returns true but no mail is actually sent.
I tried monitoring the DBus calls using dbus-monitor and, from what I can see,
the calls made using QDBusViewer and qdbus are identical.
This is what I get using qdbus:
method call time=1586454311.104053 sender=:1.392 -> destination=org.kde.kmail2
serial=5 path=/MailTransportService; interface=org.kde.mailtransport.service;
member=sendMessage
string "xxxxx at xxx.it"
string "yyyyyy at yyy.it"
string ""
string ""
string "test"
string "Test"
array [
]
And this is what I get when using QDBusViewer:
method call time=1586454543.815489 sender=:1.368 -> destination=org.kde.kmail2
serial=182 path=/MailTransportService;
interface=org.kde.mailtransport.service; member=sendMessage
string "xxxxx at xxx.it"
string "yyyyyy at yyy.it"
string ""
string ""
string "test"
string "Test"
array [
]
The only difference I can spot between the two outputs is the "serial" value
but, from what I understand, that is not something you can decide yourself.
Does anyone have any idea on what I'm doing wrong?
Thanks in advance
Stefano
More information about the kdepim-users
mailing list