Bug 162677 - Mail-Merge works fine to produce letters and envelopes, but it crashes when I try to send e-mails
Summary: Mail-Merge works fine to produce letters and envelopes, but it crashes when I...
Status: NEEDINFO
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.6.7.2 release
Hardware: ARM macOS (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: QA:needsComment
Keywords:
Depends on:
Blocks: Mail-Merge
  Show dependency treegraph
 
Reported: 2024-08-29 03:58 UTC by Harris Greenberg
Modified: 2025-10-22 19:30 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Harris Greenberg 2024-08-29 03:58:39 UTC
Description:
I have tried both LibreOffice Version 7.6.7 and 24.2.5 to do Mail-Merge to send e-mails on my iMac.  Mail-Merge works perfectly in both programs to create letters and evelopes for snail-mail, but it crashes with error messages (which I will provide) when I try to do Mail-Merge to send e-mails.

Steps to Reproduce:
1.Open Mail-Merge in Writer, Select email, Link a Calc data file, and select relevant fields
2.Preview to see Mail-Merge is working 
3.Select a range of data fields, add an email title, and start the Mail-Mmrge - ends with an error message with subroutine location errors.

Actual Results:
Here is a copy of the error messages received with both 7.6.7.2 and 24.2.5:

When using LibreOffice version 24.2.5 - I got the following error message:

<class 'smtplib.SMTPSenderRefused'>: (530, b'5.7.0 Authentication Required. For more information, go to\n5.7.0  https://support.google.com/mail/?p=WantAuthError 41be03b00d2f7-7cd9ac99525sm1493556a12.9 - gsmtp', 'hrgreenberg@gmail.com'), traceback follows
  File "/Applications/LibreOffice 24.2.5.app/Contents/Resources/mailmerge.py", line 290, in sendMailMessage
    self.server.sendmail(sendermail, truerecipients, msg.as_string())
  File "/Applications/LibreOffice 24.2.5.app/Contents/Frameworks/LibreOfficePython.framework/Versions/Current/lib/python3.8/smtplib.py", line 885, in sendmail
    raise SMTPSenderRefused(code, resp, from_addr)

 at /Users/cloph/build/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/uno/RuntimeException.hdl:24

====================================================================================
When using LibreOffice version 7.6.7 - I got the following error message:

<class 'smtplib.SMTPSenderRefused'>: (530, b'5.7.0 Authentication Required. For more information, go to\n5.7.0  https://support.google.com/mail/?p=WantAuthError 41be03b00d2f7-7cd9ad552aasm1501325a12.59 - gsmtp', 'hrgreenberg@gmail.com'), traceback follows
  File "/Applications/LibreOffice 7.6.7.app/Contents/Resources/mailmerge.py", line 262, in sendMailMessage
    self.server.sendmail(sendermail, truerecipients, msg.as_string())
  File "/Applications/LibreOffice 7.6.7.app/Contents/Frameworks/LibreOfficePython.framework/Versions/Current/lib/python3.8/smtplib.py", line 885, in sendmail
    raise SMTPSenderRefused(code, resp, from_addr)



Expected Results:
The Mail-Merge failed and only resulted in the error messages above.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 24.2.5.2 (AARCH64) / LibreOffice Community
Build ID: bffef4ea93e59bebbeaf7f431bb02b1a39ee8a59
CPU threads: 8; OS: macOS 14.6.1; UI render: Skia/Metal; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

=================================================================================
Version: 7.6.7.2 (AARCH64) / LibreOffice Community
Build ID: dd47e4b30cb7dab30588d6c79c651f218165e3c5
CPU threads: 8; OS: Mac OS X 14.6.1; UI render: Skia/Metal; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 Dieter 2025-04-18 16:33:53 UTC
Harris, it seems that nobody could reproduce the bug. So could you please retest with LO 25.2? Thank you.

=> NEEDINFO
Comment 2 TrevorA 2025-10-15 20:07:03 UTC
I downloaded latest version 25.8.2.2 and can confirm same experience as OP. 

Writer works correctly when writing to file but when I use email it sends the first record and then crashes. Behaviour repeats every time. 

I tried both Gmail and Fastmail SMTP with same effect. 

Tried resetting preferences too.
Comment 3 TrevorA 2025-10-15 20:07:56 UTC
NB I'm on a Macbook Pro macOs 15.4
Comment 4 TrevorA 2025-10-16 11:08:13 UTC
Further to that I tried the solution at:

https://stackoverflow.com/questions/34949283/error-with-libre-office-ssl-and-gmail

which involves changing
>self.server = smtplib.SMTP(server, port,timeout=tout)
to
>self.server = smtplib.SMTP_SSL(server, port,timeout=tout)
using port 465 and unchecking TLS/SSL

but that didn't seem to have any effect.

Also tried chatgpt which seemed to try a similar but more complicated solution. 

It's verdict to message

>Task policy set failed: 4 ((os/kern) invalid argument)

"This is not a Python exception — it’s an OS-level warning generated by macOS when LibreOffice’s background threads or timers interact with GUI objects.

LibreOffice 25.x Python bridge sometimes triggers this when multiple Mail Merge messages are sent in a single batch.

These warnings do not necessarily mean the email failed — they often appear even when the mail is sent successfully."

NB to see python debug messages then it suggested using this in terminal:

export LO_DEBUG_MAILMERGE=1
/Applications/LibreOffice.app/Contents/MacOS/soffice --writer
Comment 5 Alex Thurgood 2025-10-22 19:22:21 UTC
A few things come to mind in all of what the OP has posted so far:

1) Do you have an actual copy of the file smtplib.py at 

/Applications/LibreOffice 24.2.5.app/Contents/Frameworks/LibreOfficePython.framework/Versions/Current/lib/python3.8/smtplib.py" ?

2) Can you call it from within a running LibreOffice instance ?

3) Do you have a different system version of the python environment?

4) What is the architecture type of your macOS?