Bug 514044 - External Script Plugin %body argument is always empty for HTML mails
Summary: External Script Plugin %body argument is always empty for HTML mails
Status: ASSIGNED
Alias: None
Product: kmail2
Classification: Applications
Component: commands and actions (other bugs)
Version First Reported In: 6.6.0 (25.12.0)
Platform: openSUSE Linux
: NOR minor
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-01-01 15:06 UTC by Juriën Huisman
Modified: 2026-01-05 07:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juriën Huisman 2026-01-01 15:06:44 UTC
SUMMARY
When using the %body argument to an external script, the %body argument is always empty instead of containing the body/contents of the selected mail on which the external script is run. I have tried both HTML and plaintext mails.   

STEPS TO REPRODUCE
0. Create a script that allows you to see the %body argument, for example:
```
#!/bin/bash
kdialog --passivepopup "$1" 10
``` 
1. Go to `Settings`->`Configure KMail`->`Plugins` 
2. Enable the 'External Script' plugin (checkbox) and click the configure button
3. Click Add Script
4. Fill in a name and for Executable pick your script
5. Add %body in the argument field (just %body without quotes)
6. Click OK and apply the changes
7. Right click on a message -> External Script -> Name you gave the script

OBSERVED RESULT
The kdialog pop up appears, but is empty. 
Using #1 in the script shows that there is an argument (number of arguments = 1), but apparently it filled with an empty string?
Other values such as %s and %from work as expected.

EXPECTED RESULT
The %body argument should not be empty => the KDialog pop up window should show the body/content of the selected mail.

SOFTWARE/OS VERSIONS
KDE Plasma Version:  6.5.4
KDE Frameworks Version: 6.21.0
Qt Version: 6.10.1

ADDITIONAL INFORMATION
Comment 1 Laurent Montel 2026-01-01 15:20:42 UTC
I will look at it.
Regards
Comment 2 Juriën Huisman 2026-01-01 19:09:20 UTC
Correction, it does work for plaintext e-mails, but not HTML e-mails.
Comment 3 Laurent Montel 2026-01-02 10:03:13 UTC
I confirm it
Comment 4 Laurent Montel 2026-01-05 07:01:50 UTC
Git commit 27cb390bcc57f2d8d2349751fb8c61409eccf19f by Laurent Montel.
Committed on 05/01/2026 at 07:01.
Pushed by mlaurent into branch 'master'.

Fix External Script Plugin %body argument is always empty for HTML mails

Not perfect yet but allow to return not empty text

M  +8    -2    plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscriptparseargument.cpp

https://invent.kde.org/pim/kdepim-addons/-/commit/27cb390bcc57f2d8d2349751fb8c61409eccf19f