LibreOffice MailMerge and SSL

Since 2013, LibreOffice Writer has a known bug regarding the mail merge wizard: Sending merged mails using a SSL connection to the SMTP server will fail.

There’s a workaround (thanks to Andrea Tessadri) – one has to edit the python script responsible for sending the mails. It’s called mailmerge.py, and you’ll find it (on a linux box) under /usr/lib/libreoffice/program/ .

To make sending mails using SSL work, make sure that no LO process is running (check quickstart!). Now, open /usr/lib/libreoffice/program/mailmerge.py (on Linux: with root privileges), search for the line

self.server = smtplib.SMTP(server, port,timeout=tout)

and replace it by

self.server = smtplib.SMTP_SSL(server, port,timeout=tout)

Now, when sending merged documents via mail, don’t enable SSL in the mail settings; just set the port to 465. Now, sending merged documents as mail should work.