0

Network connection working but outgoing server not under Libre Office - 4.4.7.2 version. Any help with this?

LibreOffice could not connect to the outgoing mail server. Check your system's settings and the settings in LibreOffice. Check the server name, the port and the secure connections settings
--
<class 'smtplib.SMTPServerDisconnected'>: Connection unexpectedly closed, traceback follows
  C:\Program Files (x86)\LibreOffice 4\program\python-core-3.3.3\lib\smtplib.py:375 in function getreply() [raise SMTPServerDisconnected("Connection unexpectedly closed")]
  C:\Program Files (x86)\LibreOffice 4\program\python-core-3.3.3\lib\smtplib.py:322 in function connect() [(code, msg) = self.getreply()]
  C:\Program Files (x86)\LibreOffice 4\program\python-core-3.3.3\lib\smtplib.py:241 in function __init__() [(code, msg) = self.connect(host, port)]
  C:\Program Files (x86)\LibreOffice 4\program\mailmerge.py:100 in function connect() [self.server = smtplib.SMTP(server, port,timeout=tout)]
tohuwawohu
  • 13,268
  • 4
  • 42
  • 61

2 Answers2

0

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/, and on a windox box, it's located in C:\Program Files (x86)\LibreOffice 4\program (see the last line of the error message).

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.

tohuwawohu
  • 13,268
  • 4
  • 42
  • 61
  • : 'module' object has no attribute 'SMTP_SSL', traceback follows C:\Program Files (x86)\LibreOffice 4\program\mailmerge.py:100 in function connect() [self.server = smtplib.SMTP_SSL(server, port,timeout=tout)] – Cătălin George Feștilă Jan 23 '16 at 11:05
  • Hmm - is this a plain vanilla LibreOffice installation? Did you try http://stackoverflow.com/questions/30545442/sorry-unexpected-error-module-object-has-no-attribute-smtp-ssl ? I've "repaired" different LO installations using the modification i've described, and i've never encountered that error... – tohuwawohu Jan 23 '16 at 12:47
  • Did you apply more modifications to the mailmerge script than i've proposed? Please compare with https://docs.libreoffice.org/scripting/html/mailmerge_8py_source.html – tohuwawohu Jan 23 '16 at 12:50
  • I try to use SMTP_SSL - not working , I change back SMTP, then used Update All from menu and I got the last error with – Cătălin George Feștilă Jan 24 '16 at 15:25
  • I'm not sure about "update all" - to which menu dies that belong? – tohuwawohu Jan 24 '16 at 15:28
  • ah - that' strange - why does updating fields and so on issue a SSL request? Sorry, i fear i can't help with this - at least wiithout knowing your document. Is there a way to provide a minimal test example? – tohuwawohu Jan 26 '16 at 07:07
0

In LibreOffice 6.0.2.1

  1. Tick SSL but use Port 587 would normally be for tls
  2. Allow access for less safe apps in your gmail security settings

Worked for my account although I wonder how safe it is to allow "less secure apps"

Mohammad Kanan
  • 4,452
  • 10
  • 23
  • 47
Stefan
  • 16
  • 1