Smtp test email fails with message 'Send Test Message failed : Message could not be sent.'

OS Name/Version: Raspberry Pi OS Lite 64bit based on Debian version: 11 (bullseye)

Product Name/Version: AMP Release “Triton” v2.3.2.8, built 28/03/2022 15:34

Problem Description:

I have set up the External Services section with all the required information for gmail smtp, but I get the mentioned error message. Now, if I get any of the info wrong, the error message lets me know. But once everything is proper it still does not work. The gmail application password did not populate a ‘last used’ date, so it seems to be failing internally.

Actions taken to resolve so far:
Changed personal email in own profile to something else than smtp login.
Changed the Email ‘From’ address to something else than smtp login
Added SSL smtp port to firewall (645 TCP)
Stopped firewalld entirely
Set Monitoring and Metrics section to Full process metrics, but no info is collected when you press the send test email button.
Used browser dev console to look at networking. But the button press resulted in a 200 OK POST action.

Turn on debug mode to check out more exactly what’s wrong and then check AMPs logs: Diagnosing AMP issues · CubeCoders/AMP Wiki · GitHub

Ok getting somewhere now. Here is the error with debug lvl 0:

[EmailSender:Holyme Debug] : Sending email to [redacted]
[EmailSender:Holyme Debug] : Unable to send email: System.Net.Mail.SmtpException: Message could not be sent. —> System.IO.IOException: Connection closed
at System.Net.Mail.SmtpClient.Read () [0x000bd] in :0
at System.Net.Mail.SmtpClient.SendCore (System.Net.Mail.MailMessage message) [0x00000] in :0
at System.Net.Mail.SmtpClient.SendInternal (System.Net.Mail.MailMessage message) [0x00050] in :0
at System.Net.Mail.SmtpClient.Send (System.Net.Mail.MailMessage message) [0x00084] in :0
— End of inner exception stack trace —
at System.Net.Mail.SmtpClient+<>c__DisplayClass90_0.b__0 (System.Object o, System.ComponentModel.DoWorkEventArgs ea) [0x0002c] in :0
at System.ComponentModel.BackgroundWorker.OnDoWork (System.ComponentModel.DoWorkEventArgs e) [0x0000a] in :0
at System.ComponentModel.BackgroundWorker.WorkerThreadStart (System.Object argument) [0x0000e] in :0
— End of stack trace from previous location where exception was thrown —

at EmailSenderPlugin.PluginMain.SendMail (System.String To, System.String Subject, System.String Message, System.Net.Mail.MailPriority Priority) [0x0013f] in :0

The connection closed part is interesting, am I still blocking the email somehow?