Bug 116211 - LO Send by email fails from claws-mail
Summary: LO Send by email fails from claws-mail
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
6.0.2.1 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 138158 154479 (view as bug list)
Depends on:
Blocks: File-Send Thunderbird-Interoperability
  Show dependency treegraph
 
Reported: 2018-03-05 17:13 UTC by Bernard Moreton
Modified: 2023-09-23 17:10 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
A proposed revision for /usr/lib/libreoffice/program/senddoc (13.28 KB, text/plain)
2018-10-08 11:13 UTC, Bernard Moreton
Details
revision of (current) senddoc to correct problems (16.56 KB, application/x-shellscript)
2022-07-10 14:12 UTC, Bernard Moreton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernard Moreton 2018-03-05 17:13:13 UTC
Description:
When tools/options/internet/email is set to /usr/bin/claws-mail, send by email fails.  If it's unsert, to allow a default of xdg-email, it still fails, and if it's explicitly set to /usr/bin/xdg-email it still does not work.  Trying to Send now leaves me in limbo, somewhere between LO and my email client (Claws), with neither having focus, so alt-tab gets me nowhere until I manually reassert focus on one or the other.
Build ID: 1:6.0.2~rc1-0ubuntu0.16.04.1~lo1
on Ubunto 16.04.4 LTS

Help (on tools/options/internet/email) is not at all helpful,
and Browse isn't either - on my system it includes claws-mail.

If I select xdg-email, then I get the same result s for Claws.
xdg-email --attach <FILE> works fine for me from the command line.

If AppArmor has to be enforced, then suitable documentation should be provided for new users.  It seems that security is now a step ahead of usability?

Steps to Reproduce:
1.Set email cliednt (tools/options) to claws-mail or xdg-email
2.send (current) document as attachment
3.

Actual Results:  
Neither LO nor email client has focus, and nothing happens

Expected Results:
Document should be properly attached to n (draft) email


Reproducible: Always


User Profile Reset: Yes


OpenGL enabled: Yes

Additional Info:
Always worked fine until 6.0


User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/538.1 (KHTML, like Gecko) QupZilla/1.8.9 Safari/538.1
Comment 1 Olivier Tilloy 2018-03-06 07:32:06 UTC
Tested and I can reproduce the issue when claws-mail is the default e-mail client on the system, even with apparmor profiles disabled (so unlikely to be an apparmor-related issue).
Comment 2 Dieter 2018-03-06 08:14:20 UTC Comment hidden (obsolete)
Comment 3 Bernard Moreton 2018-09-17 11:16:48 UTC Comment hidden (obsolete)
Comment 4 Bernard Moreton 2018-09-17 13:14:22 UTC
I see a similar report on Apache OpenOffice, also on the Ubuntu bug reports.
Following a hint from the latter, I deleted the entry "/usr/bin/claws-mail" in Tools/Options/Internet/Email and tried again to send a document.  This time no error was reported to the GUI, but I'd called soffice from the commandline, and there an error had appeared "/usr/lib/libreoffice/program/senddoc: 361: /usr/lib/libreoffice/program/senddoc: /usr/bin/claws-mail: Permission denied"

A long listing shows
-rwxr-xr-x 1 root root 3950472 Dec 17  2017 /usr/bin/claws-mail
which looks ok?

I'll restore the setting in Tools/Options, since a visible error message is better than an invisible one!
Comment 5 Bernard Moreton 2018-09-18 09:50:33 UTC
I modified 'senddoc' temporarily, to 'echo' the claws-mail command, and opened my testfile again from the commandline.  That showed 
/usr/bin/claws-mail --attach /tmp/lu35337hoq3k.tmp/lu35337hoq3n.tmp/errors_090715.odt
(all on one line).

A further edit to 'ls' the attachment file gave
/usr/lib/libreoffice/program/senddoc: 363: /usr/lib/libreoffice/program/senddoc: ls: Permission denied

Running the claws-mail command from the commandline (while LO was still open) gave a similar result: file does not exist, or no permission.

Doing 'ls -l' from the command line shows the file still existing, with directory permissions restricted to me as the owner.

A permissions problem, then?  But I can't see what it is.
Comment 6 Bernard Moreton 2018-09-18 11:23:56 UTC
See also Ubuntu Bug #1748895 
LO unable to find a working email configuration
Comment 7 Bernard Moreton 2018-09-20 09:56:35 UTC
With respect, I think the problem is related to apparmor.
When Tools/Options/Internet/Email is set to /usr/bin/claws-mail, the error window appears (working email client not found), an error message is sent to screen (Writer called from the command line),
"/usr/lib/libreoffice/program/senddoc: 366: /usr/lib/libreoffice/program/senddoc: /usr/bin/claws-mail: Permission denied", and the kernel log contains 3 DENIED lines,
Sep 20 10:09:04 USER_ID-Inspiron-5767 kernel: [ 1965.191418] audit: type=1400 audit(1537434544.991:41): apparmor="DENIED" operation="file_inherit" profile="libreoffice-senddoc" name="/home/USR/errors_090715.odt" pid=4934 comm="senddoc" requested_mask="wr" denied_mask="wr" fsuid=1001 ouid=1001
Sep 20 10:09:04 USER_ID-Inspiron-5767 kernel: [ 1965.191423] audit: type=1400 audit(1537434544.991:42): apparmor="DENIED" operation="file_inherit" profile="libreoffice-senddoc" name="/home/USR/.config/libreoffice/4/user/uno_packages/cache/uno_packages.pmap" pid=4934 comm="senddoc" requested_mask="wr" denied_mask="wr" fsuid=1001 ouid=1001
Sep 20 10:09:05 USER_ID-Inspiron-5767 kernel: [ 1965.196286] audit: type=1400 audit(1537434544.995:43): apparmor="DENIED" operation="exec" profile="libreoffice-senddoc" name="/usr/bin/claws-mail" pid=4940 comm="senddoc" requested_mask="x" denied_mask="x" fsuid=1001 ouid=0

If Tools ... Email is set to xdg-email (timed at 10:12) or set to be blank (timed at 10:16), then no error window appears, the screen error message does not appear, and two DENIED lines appear in the kernel log:

Sep 20 10:12:24 USER_ID-Inspiron-5767 kernel: [ 2164.882567] audit: type=1400 audit(1537434744.681:53): apparmor="DENIED" operation="file_inherit" profile="libreoffice-senddoc" name="/home/USR/errors_090715.odt" pid=5014 comm="senddoc" requested_mask="wr" denied_mask="wr" fsuid=1001 ouid=1001
Sep 20 10:12:24 USER_ID-Inspiron-5767 kernel: [ 2164.882572] audit: type=1400 audit(1537434744.681:54): apparmor="DENIED" operation="file_inherit" profile="libreoffice-senddoc" name="/home/USR/.config/libreoffice/4/user/uno_packages/cache/uno_packages.pmap" pid=5014 comm="senddoc" requested_mask="wr" denied_mask="wr" fsuid=1001 ouid=1001

Sep 20 10:16:27 USER_ID-Inspiron-5767 kernel: [ 2408.161860] audit: type=1400 audit(1537434987.959:65): apparmor="DENIED" operation="file_inherit" profile="libreoffice-senddoc" name="/home/USR/errors_090715.odt" pid=5171 comm="senddoc" requested_mask="wr" denied_mask="wr" fsuid=1001 ouid=1001
Sep 20 10:16:27 USER_ID-Inspiron-5767 kernel: [ 2408.161865] audit: type=1400 audit(1537434987.959:66): apparmor="DENIED" operation="file_inherit" profile="libreoffice-senddoc" name="/home/USR/.config/libreoffice/4/user/uno_packages/cache/uno_packages.pmap" pid=5171 comm="senddoc" requested_mask="wr" denied_mask="wr" fsuid=1001 ouid=1001
Comment 8 Bernard Moreton 2018-09-20 10:01:12 UTC
I should have added that when Tools ... Email is set to xdg-email (timed at 10:12) or set to be blank (timed at 10:16), then claws-mail is called, but without focus, and without any COMPOSE window.  Focus has to be manually restored to CLAWS by clicking on it, before anything else can be done ...
Comment 9 Bernard Moreton 2018-09-22 10:39:55 UTC
Sorry to post so much, but I think I've found the problem, and a solution.

1  For convenience, I've set Tools/Options/Internet/Email to use /usr/bin/xdg-email

2  The supplied senddoc then outputs the command (all on one line):
/usr/bin/xdg-email mailto:?subject=errors_090715&attach=file:///tmp/lu3461d8a63c.tmp/lu3461d8a63f.tmp/errors_090715.odt &
This brings my claws-mail window to the fore, but without focus, and fails to open a compose window.
If I run the same command by copy-n-paste from the command line, then a compose window opens, but there is no attachment.

3  If I change the xdg entry in senddoc
--attach)
                    MAILTO="${MAILTO:-}${MAILTO:+&}attach="$(echo "$2" | "${URI_ENCODE}")
                    #MAILTO="${MAILTO:-}${MAILTO:+&}attach="$(echo "file://$2" | "${URI_ENCODE}")
                    shift
                    ;;
and take out the ampersand in the mail call (may not be significant, but calls for other mail clients don't use the ampersand, and senddoc will then wait for completion)
        ${MAILER} "${MAILTO}"
        # ${MAILER} "${MAILTO}" &
then senddoc completes properly, opening a compose window, with the required attachment.

4  Apparmor still registers two DENIED lines to kernel.log, one about the original file opened in Writer, and one about the .config file (see my Comment 7 above). These don't have any effect on the functioning of Senddoc, but they shouldn't appear.

5  The solution outlined above is not complete
(1) it may have bad effect on Evolution and/or Gnome, which are linked with Xdg in the 'case' statement
(2) the provision to cover a blank entry in Tools/Options/Internet/Email needs to be changed in line with the change in the entru for Xdg
(3) though the output command
/usr/bin/xdg-email mailto:?subject=errors_090715&attach=/tmp/lu3461d8a63c.tmp/lu3461d8a63h.tmp/errors_090715.odt
works ok, it is not in accord with the format given in the man page for xdg-email ( --subject TITLE --attach FILE), which I find a little disturbing.
Comment 10 Bernard Moreton 2018-10-08 11:13:15 UTC
Created attachment 145467 [details]
A proposed revision for /usr/lib/libreoffice/program/senddoc

A proposed revision for /usr/lib/libreoffice/program/senddoc
Comment 11 Bernard Moreton 2018-10-08 11:15:16 UTC
The uploaded revision of SENDDOC works ok on my system (LO 6.1.2.1, Ubuntu 18.04.1) when Tools, Options, Internet, Email E-mail program is left blank, or filled as /usr/bin/xdg-email.

The URI syntax "file://" for attachments does not work with (most?) system email clients; and I have left comments at lines 109, 380, and 443, where I doubt whether this syntax is appropriate for thunderbird, Mail or Thunderbird, or for DESKTOP_LAUNCHER.
All instances need review however.

I've tested a call using /usr/bin/xdg-open in my configuration setting.  This has the same problem as I had with xdg-email, ie Sending a file by email opened my email client, but without focus, and no compose window appeared.
I conclude that the URI syntax is unreliable, and that a simple filename reference should therefore be preferred.
I have not implemented that in my uploaded revision of SENDDOC!


On a LINUX system, the clients provided for in SENDDOC should all be ok (I think) when AppArmor is not in use.

Where AppArmor is in use, and there is a policy set for SENDDOC, then I suggest that
(a) the Options-Internet-Email program should not allow input, but perhaps should show the system default email client; and
(b) to avoid problems, the call to SENDDOC should not pass any client identification.
Comment 12 Xisco Faulí 2018-10-08 11:18:51 UTC
Hi Bernard,
Thanks for the patch!
Would you mind submitting it to gerrit instead? you can have more informacion here https://wiki.documentfoundation.org/Development/gerrit/SubmitPatch
Comment 13 Bernard Moreton 2018-10-08 18:09:18 UTC
Hi Xisco,

I'm afraid I'm not familiar with GIT - perhaps I should be, but 24x7 care leaves me little opportunity for doing new things.  Would you mind submitting the revision for me?  License? - as for the existing SENDDOC, of course - or whatever is most free.

MTIA, Bernard
Comment 14 pharmankur 2018-11-11 09:11:41 UTC
Since upgraded to LO 6.1.0 onwards started facing the problem of documents send by email stopped working

Also post here mentions about a macro which sends email with PDF attachment using a email client as THUNDERBIRD, the basic issue is setting [ Libreoffice --> TOOLS --> OPTIONS --> INTERNET --> E-MAIL --> EMAIL PROGRAM --> browse & set to --> /usr/bin/thunderbird ] is not firing up THUNDERBIRD

BUT Geary works with same LO 6.1.2 [ Libreoffice --> TOOLS --> OPTIONS --> INTERNET --> E-MAIL --> EMAIL PROGRAM --> browse & set to --> /usr/bin/geary ]


Using Linux Mint 19
---------------------------------------------------------------------------


Find my detailed posting about mentioned 'MACRO' at

https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=89073&p=457389#p426971


>>>

After upgrading to Linux Mint 19 + Thunderbird 60 + Libreoffice 6.1.2 ; Emailing through the macro suddenly started behaving strangely. The email body text generated through macro started appearing in Recipient email boxes in thunderbird and is not usable.
Setting up Thunderbird as email client [ Libreoffice --> TOOLS --> OPTIONS --> INTERNET --> E-MAIL --> EMAIL PROGRAM --> browse & set to --> /usr/bin/thunderbird ] in libreoffice is also not working; as it is no more firing up thunderbird.

I do not know what is going wrong , Also I dont know whether bug is in Libreoffice Or Thunderbird Or somewhere else.

But here is the finely working workaround ---
Solution is to use geary email client, Set GEARY as default email client in linux mint. Also set geary in libreoffice [ Libreoffice --> TOOLS --> OPTIONS --> INTERNET --> E-MAIL --> EMAIL PROGRAM --> browse & set to --> /usr/bin/geary ]




......... UPDATE ...........

Tested with Libreoffice 6.0.7.3 in Linux Mint 19 & with Thunderbird 60.2.1 (64-bit) --- And it worked charmingly as before !!!

So definitely Libreoffice 6.1.2 has the bug, strangely specific to THUNDERBIRD only ... as GEARY works in both version of libreoffice.

<<<<<<
Comment 15 Bernard Moreton 2018-11-11 14:13:58 UTC
GEARY works simply because it is not named in program senddoc, which then uses xdg-email as a default, to call the system email client, whatever it is.  But hey, as an entry in Tools/.../Internet, it works!  

So, possibly, would "/usr/bin/wxyz" ...
Comment 16 pharmankur 2018-11-12 17:37:35 UTC
(In reply to Bernard Moreton from comment #15)
> GEARY works simply because it is not named in program senddoc, which then
> uses xdg-email as a default, to call the system email client, whatever it
> is.  But hey, as an entry in Tools/.../Internet, it works!  
> 
> So, possibly, would "/usr/bin/wxyz" ...

:)
Did not get you Bernard !

So there is a bug or not ??? Because since LO 6.0.7 Thunderbird was working for me with exactly same configuration.

Now Geary is working but not the thunderbird. For whatever reason same configs are working for Geary and not for Thunderbird Or Kmail Or Claws Mail , isn't it a bit odd ?

I am habituated to use Thunderbird, Geary even though works; I feel compromised while using it. Thus earlier this bug is resolved ... it will be better !!

Meanwhile I have fallen back to LO 6.0.7 & enjoying using Thunderbird.
Comment 17 Bernard Moreton 2019-08-14 11:04:15 UTC
6.3.0.4 includes most of the changes I suggested, but still fails to operate properly - it switches the focus to the email client, but fails to create a new email.

I thnk the problem may be at senddoc line 293,
MAILTO="${MAILTO:-}${MAILTO:+&}attach="$(echo "file://$2" | "${URI_ENCODE}")

My email client (Claws-mail) fails to handle the "file://" syntax, as do some other email clients.

My suggestion (lines 269-276 of my proposed revision) was to omit the file:// (at least for xdg-email), so that the command then is
MAILTO="${MAILTO:-}${MAILTO:+&}attach="$(echo "$2" | "${URI_ENCODE}")

That then works;  though I found it advisable to omit the ampersand in the mail command (can't immediately remember why, sorry!), so that that command became simply
${MAILER} "${MAILTO}"

Version: 6.3.0.4
Build ID: 1:6.3.0-0ubuntu0.18.04.1~lo2
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: en-GB (en_GB.UTF-8); UI-Language: en-GB
Calc: threaded
Comment 18 Bernard Moreton 2020-11-26 11:30:59 UTC
There is a new twist to this saga.
With LO 7.0.1.2 today I get an error message
/home/mbm/.claws-mail/mimetmp/.comments: unlink: Is a directory

** (claws-mail:12915): WARNING **: 10:04:23.190: failed to convert encoding of file name: Invalid byte sequence in conversion input
malloc_consolidate(): invalid chunk size

This happens whether I set email (Tools,Option) as blank, or as xdg-email
In either case, using my proposed patched form of sesnddoc, I get a Claws-mail error window within a Compose window.  On acknowledging the message, Claws crashes.

If I use the version of senddoc that comes with LO 7.0.1.2, I get no Compose window, and Claws-mail simply crashes.

This was working ok a fortnight ago, with LO 7.0.1.2
Claws-mail has not changed in Ubuntu 20.04 since then.
I wonder whether uri-encode is no longer working properly?

And if I export my LO document to a file, then I can Compose, and attach that file, and send, all ok
Comment 19 Oblong 2020-11-27 06:06:03 UTC
Hopefully not confusing things by adding this information... I use LibreOffice "E-mail as PDF" a lot. After about a fortnight of not having used it, when it worked fine, today I tried again.

Linux Mint 19.3 MATE; Thunderbird 68.10.0; LibreOffice 6.0.7.3.
LO Tools|Options|Internet|E-mail program field is blank (and has always been like that).

The Thunderbird compose window opened, but there was no attachment. No improvement after closing/restarting LO, Thunderbird or restarting Mint.

kern.log has:

Nov 27 14:51:03 bob-mint kernel: [ 1934.824706] audit: type=1400 audit(1606452663.111:205): apparmor="DENIED" operation="file_inherit" profile="libreoffice-senddoc" name=2F686F6D652F626F622F446F63756D656E74732F576F72642F424F422F4F626C6F6E672F54617820496E766F696365732F323032302F323032303131323730322D626967672D64616E2E6F6474 pid=7510 comm="senddoc" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000

Nov 27 14:51:03 bob-mint kernel: [ 1934.824714] audit: type=1400 audit(1606452663.111:206): apparmor="DENIED" operation="file_inherit" profile="libreoffice-senddoc" name="/home/bob/.config/libreoffice/4/user/uno_packages/cache/uno_packages.pmap" pid=7510 comm="senddoc" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000

Nov 27 14:51:03 bob-mint kernel: [ 1934.824719] audit: type=1400 audit(1606452663.111:207): apparmor="DENIED" operation="file_inherit" profile="libreoffice-senddoc" name="/usr/share/libreoffice/help/en-US/shared.jar" pid=7510 comm="senddoc" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

LO has no problem exporting the PDF and Thunderbird can manually attach it.

Caja 1.22.2 right-click Send to...E-mail works as expected.

If I run "libreoffice --writer" from the terminal there are no error messages there when doing the E-mail as PDF, but again no attachment appears.

The only thing I was brave enough to change, as the log mentioned it, was to change the permission of:
/home/bob/.config/libreoffice/4/user/uno_packages/cache/uno_packages.pmap
to 777. Made no difference.

Not sure what it all means!
Comment 20 Bernard Moreton 2020-11-27 09:00:31 UTC
Just to clarify my remarks yesterday,
the error window in Claws-mail showed a filename that looked very much as though it had been encoded.

There may be some upgrade to the system that caused the change in behaviour -
simplescan has taken to ignoring the ADG and scanning from the glass,
Acroread has also taken to printing only the first page of any page selection.
It's difficult not to suspect some common cause.

But in senddoc
attachment="$(echo "file://$2" | "${URI_ENCODE}")
may be suspect anyway?
Comment 21 Bernard Moreton 2020-11-27 12:41:33 UTC
And further to my last comment, the point is proved.
Claws[-mail] is set in senddoc to use
ATTACH="${ATTACH:-}${ATTACH:+ }$2"
without any reference to encoding.

In Tools.Options, I set email to /usr/bin/claws-mail
and all is well, the document is attached to a draft email in  a Compose window.

The use of URI_ENCODE in conjunction with the attachment filename seems to be wrong - though why it caused no problems until recently I do not understand!
Comment 22 Oblong 2021-01-19 01:39:50 UTC
I noticed a couple of days ago (17th or 18th Jan 2021) that Send e-mail as PDF started to work again. Presumably some update fixed things. So that's great!

(Linux Mint MATE 19.3, Thunderbird 68.10.0, LibreOffice Version: 6.0.7.3 - all those versions unchanged.)
Comment 23 Bernard Moreton 2021-05-05 11:20:04 UTC
In the current version of LO, 7.1.2.2 (Ubuntu build, on Ubuntu 20.04 LTS),
there has been no change to senddoc since the last installed version (7.0.1.2),
but the behaviour is significantly different.

1
Using the supplied senddoc (7.1.2.2), and trying to send a PDF attachment,

(a)
if Tools/Options/Internet/Email is set as <blank>, 
Claws-mail freezes, so that no ALT-TAB is possible, and has to be shut down,
and I gete a message on Terminal:
 /home/mbm/.claws-mail/mimetmp/.comments: unlink: Is a directory
** (claws-mail:7281): WARNING **: 11:27:50.598: failed to convert encoding of file name: Invalid byte sequence in conversion input

(b)
If Tools/Options/... is set to /usr/bin/claws-mail
I get an LO error window 'unable to find a working email configuration
and an error on Terminal
"/usr/lib/libreoffice/program/senddoc: 387: /usr/bin/claws-mail: Permission denied"  (perhaps from AppArmor ???)

(c)
If Tools/Options/... is set to /usr/bin/xdg-email
then focus switches to the Claws-mail client, but no Compose window appears, and no error message is given,  but the Claws-mail window is frozen, without focus, and needs to be clicked intofocus before anything more can be done.

2
Using the fix script I suggested some while ago, and trying to send a PDF attachment,
if Tools/Options/Internet/Email is set to /usr/bin/claws-mail (my standard client), I get a LO error "unable to find a working email configuration".
If I set the option to either /usr/bin/xdg-email or to <blank>,
I get an error on my Claws-mail client, File <encoded garbge> doesn't exist or permission denied", and the email clinet is closed altogether when I close the er3ror message window.
and sometimes (not always) I get an error on my Terminal,
** (claws-mail:7281): WARNING **: 11:27:50.598: failed to convert encoding of file name: Invalid byte sequence in conversion input

3
I note that in senddoc, against the "sylpheed | claws" entry, there is
ATTACH="${ATTACH:-}${ATTACH:+ }$2"
and against xdg-email there is
MAILTO="${MAILTO:-}${MAILTO:+&}attachment="$(echo "file://$2" | "${URI_ENCODE}")

The use of URI_ENCODE here is probably not right,  the UTI file usage (file://$2) certainly doesn't work when passed to Claws-mail, and xdg-email doesn't seem to recognize it either.
Comment 24 Bernard Moreton 2021-05-05 15:30:54 UTC Comment hidden (obsolete)
Comment 25 Bernard Moreton 2021-05-05 15:36:05 UTC
I believe there is a bug in xdg-email affecting --attach
(https://bugs.launchpad.net/ubuntu/+source/xdg-utils/+bug/1909941?comments=all)
(sorry, the last attempt closed on me before I'd finished)

The fix for that wor3ks in Claws-mail 3.17.8, but not in 3.17.5 which is the latest version for Ubuntu 20.04 LTS.

I get the same error when calling xdg-email --attach FILENAME from the command-line as seems to be occurring when it is run from senddoc.

I've asked for a backport of Claws 3.17.8 to Ubuntu 20.04 ... !
Comment 26 Bernard Moreton 2021-05-12 13:23:38 UTC
Until communication between xdg-email and claws-mail is fixed in Ubuntu LTS, I've resolved the problem by (a) adding a claws-mail line in the apparmor profile for senddoc and reloading the policy. and (b) setting Tools/Options/Internet/Email to specify /usr/bin/claws-mail.
I don't like messing with system files like that, but it now works again properly.
Comment 27 Timur 2022-07-06 12:30:15 UTC
Reading this, I don't see it as LO bug. And it well may be NotOurBug. 
I restrict to claws-mail and kindly ask reporter to follow up with new version.
Since Ubuntu bug is listed, this can simply be closed.
Comment 28 Bernard Moreton 2022-07-07 08:17:08 UTC
There are 3 levels at which this is an LO bug:

(1)  senddoc provides settings for claws-mail (claws|sylpheed), which work fine, EXCEPT that since apparmor was enforced, these settings only work if claws-mail is included in the apparmor settings

(2) xdg-email is seen as the default email application, but the coding in senddoc uses the 'mailto:' command format.  The manual for xdg-email is explicit "xdg-email limits support to, cc, subject and body fields in mailto-uri, all other fields are silently ignored." 

This makes xdg-email with mailto: command format a bad choice for LO's senddoc. If the alternative command-line-style were used, with simple email addresses rather than the mailto: style, I think all would be well.  It certainly works well for me from the command line.

(3) the screen prompts for the setting of Tools-Options-Internet-Email are not helpful.  Perhaps they couldn't be until senddoc works dependably for all reasonable email clients.  

Evolution, kmail, icedove, and thunderbird are given specific entries in senddoc; I don;t know how well they work - but all other clients must be a potential problem.

The implication in this user configuration setting is that any email application should work.  That simply is not so.


I agree with Timur (#27) that a main problem in in xdg-email, but I can find no indication that its maintainers are likely to extend the capabilities of the mailto: option.  In the meantime, however, LO could and should use the command option that does the essential job of attaching the document to the email.  And then improve the Tools-Options email entry screen.
Comment 29 Timur 2022-07-07 08:56:25 UTC
I tested sending with claws-email now, previously I used mutt, and all is working, composer window is invoked and file is attached. 
I understood this bug was about claws-email but if not it needs a precision.

"xdg-email is a command line tool for sending mail using the user's preferred e-mail composer" so why would it be used in Tools/Options/Internet/Email I don't know. 
My understanding is that it's working implicitly, if you don't set Email than xdg-email is used to invoke some (from Default/Preferred Applications). 
In my case, when I deleted claws-email path from Email and not from the system, it used mutt. 
But I got no screen prompts for the setting of Tools-Options-Internet-Email? Please paste screenshot here. 

Mail from mutt was composed and sent but without attachment. 
I then changed system mail to claws-email and xdg-email invoked claws-email but without composer window.
So for me, bug is that xdg-email doesn't attach file or compose mail, seen when when having Email empty ie. relying on xdg-email. Mine is version 1.1.2 from Ubuntu 18.04. 
But it should be that Ubuntu bug. And there "xdg-utils 1.1.3-4.1ubuntu1.22.04.1 seems to have fixed this". 

(1) seems Ubuntu bug. (2) I wrote my view on xdg-utils (3) I asked you to clarify, to have all here, but that would be another issue anyway.
Comment 30 Timur 2022-07-07 09:28:44 UTC
Oh, not really well in Ubuntu 22.04. 
Lo has sensible-lomua set in Email (don't know what's that, probably ends with xdg-email anyway) but behaves like when empty, invoking default mail which I set to be claws-mail. Also program window invoked, not composer window. xdg-email is  1.1.3-4.1. So that would be the same, not resolved. 
Another new problem: if I set Email to /usr/bin/claws-mail, I get a message "LO unable to find a working mail configuration". claws-mail is version 4.0

If system has no default email client, sending with LO doesn't give any warning. That would be another issue, related to (3).
Comment 31 Timur 2022-07-07 09:47:25 UTC
This would be a duplicate of bug 74067 with similar problem in bug 75825. 
Or we may regard this one for sending attachment and other one for warning.
That one lists commit 8e7a3669dd86f86325b3012abc657b5d4665374d titled Combine senddoc null and default cases for better mailer selection.
Comment 32 Bernard Moreton 2022-07-07 13:23:06 UTC
I get over the problem by inserting a line for claws-mail in apparmor profile for senddoc, and specifying claws-mail (with full path) in Options-Tools-...Email.

A better option would be to rewrite the xdg-email code in senddoc along the lines of the block for claws|sylpheed (though in LO, the 'To' field is presumably not required ...).  This would make the default generally useful for all email clients, where currently it simply doesn't attach, which is the whole point of senddoc ...


I'll continue to hope that Ubuntu 22.04 xdg-utils will fix the attachment problem, since it affects scanning to email as well as LO;  but there'' be many LO users who remain on current (non-functioning) xdg-email maitto: style.  They should be helped, even if the rest of us do find salvation ...
Comment 33 QA Administrators 2022-07-08 03:37:22 UTC Comment hidden (obsolete)
Comment 34 Bernard Moreton 2022-07-10 14:12:04 UTC
Created attachment 181206 [details]
revision of (current) senddoc to correct problems

Revisions labelled #001 enable sending email when Tools-Options-Internet-Email is set to /usr/bin/xdg-email (under Ubuntu 20.04 LTS)

The revision labelled #002 enable sending document as email when Option-Email is blank - in this case LO currently does NOT supply any MAILER to senddoc.
Comment 35 Bernard Moreton 2022-07-10 14:18:11 UTC
Against Timurs comment #29, "(3) I asked you to clarify, to have all here, but that would be another issue anyway.",

- the Browse button doesn't really help the user (it listes all files in the HOME directory
- and though the user might want to enter a simple application name (and perhaps should be given a list of found names to choose from), past experience suggested that a full path may be desirable.
- the button might be better to validate an entered application name?

The user can't be assumed to know the file system!
Comment 36 Robert Cabane 2022-10-05 21:01:56 UTC
I'm having the same bug since upgrading to LO 7.4 (perhaps also 7.3.4, I don't remember).
Context : 
OpenSuSE Linux
TDF LO 7.4.1
mailer = thunderbird (declared as such in the Options)
What happens : when I try to send a doc my mail (clicking on the dedicated button), Thunderbird's composer windows appears but nothing is attached.
Comment 37 Stéphane Guillou (stragu) 2023-07-01 16:30:27 UTC
*** Bug 154479 has been marked as a duplicate of this bug. ***
Comment 38 Stéphane Guillou (stragu) 2023-07-01 16:35:16 UTC
Clearly issues to solve, including in link to Thunderbird as in duplicate but 154479.
Thanks Bernard for continuously looking into it, and please don't hesitate submitting a patch on gerrit if you think it can improve the situation.
Comment 39 Timur 2023-09-23 17:10:23 UTC
*** Bug 138158 has been marked as a duplicate of this bug. ***