How to setup outgoing mail server in libreOffice writer

I want to use mail merge to send mail to more members, while outgoing mail server i am getting problems
i am using my gmail id and wrote smtp.gmail.com as server name and by default it select port as 587.
it shows
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.SMTPAuthenticationError’>: (534, b’5.7.9 Application-specific password required. Learn more at\n5.7.9 https://support.google.com/mail/?p=InvalidSecondFactor h3sm1312560pjz.23 - gsmtp’), traceback follows
File “C:\Program Files\LibreOffice\program\mailmerge.py”, line 135, in connect
self.server.login(user, password)
File “C:\Program Files\LibreOffice\program\python-core-3.7.7\lib\smtplib.py”, line 730, in login
raise last_exception
File “C:\Program Files\LibreOffice\program\python-core-3.7.7\lib\smtplib.py”, line 721, in login
initial_response_ok=initial_response_ok)
File “C:\Program Files\LibreOffice\program\python-core-3.7.7\lib\smtplib.py”, line 642, in auth
raise SMTPAuthenticationError(code, resp)

Please provide solution as early as possible.

Please provide solution as early as possible.

Users of LibreOffice don’t provide solutions to other users. They answer questions on a voluntary basis.

To me it looks like you have set up LibreOffice correctly. You connect to the service and get a sensible response. This response does not grant you access, but points you towards possible resolution. This means you should probably ask Google, not us.

Did you acquire and use the app password, as explained in the page linked to from your error message?

You may need to enable IMAP in your Google account for this to work. It should not be required, but worth a try. You can always disable it later. See this help page.

Hello,

you cannot use smtp.gmail.com server by simply providing your google email account details, since by default Google requires OAuth authentication, which is not supported by LibreOffice. If you do that anyway, Google considers this a login try from an insecure app and rejects the login (I wonder, whether you don’t get the usual Google notification about unknown account activity, asking you, whether it was you performing that suspicious action). You would need to change your Google account’s security settings to Allow insecure apps (Check your Google account under Security - don’t know the exact English phrase Google uses for allow insecure apps; got a German interface on Google). If you allow insecure apps, login to smtp.google.com using your google credentials (email address + password) should work without OAuth.

Hope that helps.

I thought that this authentication issue would be circumvented by using the ad hoc “app password”. Didn’t bother to check. My bad!

Thanks! I have learned something today.

@keme - no, no you seem to be right as well and I’ve learned from your answer. The problem is much more complicated. If you want define app passwords, it seems you need to switch to 2-factor authentication first (otherwise the option to define app passwords is not visible under account → security). And that 2-factor thing in Google’s flavor is so annoying to me, that I don’t want to spent any further minute with it. Hence I did not test whether you also could get it working with “2-factor + app password”.

Sorry - can’t resists to argue: Google authentication is turning security so complicated (and finally annoying), that I start to understand, why more and more people stop to care about security