[App Server] Sending e-mail from local App Server - No SMTP server

Hi,
How are you?
Well, things are getting interesting.

I tried to configure the SMTP server in the yaml file like this: (with and without the double quotes (just in case), as individual parameters)
smtp-host: “smtp.gmail.com
smtp-username: “account@gmail.com
smtp-password: “password”
smtp-port: 465
smtp-encryption: “ssl” (also tried other options here)

And I got an “No SMTP server has been configured …” error


Then I configured the same but in the server_config: {} parameter of the yaml file (because this is were Anvil server writes the configuration when you mark the option for a custom SMTP server in the editor)
And I got "InternalError: Internal server error: 60220e234353"


I read that as the function is calling anvil.email.send which uses Anvil servers, it will not work in the runtime engine.

So, I run the python debug smtp server
python -m smtpd -c DebuggingServer -n localhost:1025

And I replaced the original code with:

def add_feedback(name, email, feedback):
import smtplib
from email.mime.text import MIMEText

sender = 'admin@example.com'
receivers = ['info@example.com']


port = 1025
msg = MIMEText('This is test mail')

msg['Subject'] = 'Test mail'
msg['From'] = 'admin@example.com'
msg['To'] = 'info@example.com'

with smtplib.SMTP('localhost', port) as server:
    
    # server.login('username', 'password')
    server.sendmail(sender, receivers, msg.as_string())
    print("Successfully sent email")

And I got "AnvilWrappedError: [Errno 99] Cannot assign requested address"

Then I realized that was running the engine inside a Docker container, so I run the smtpd inside the container and this last option worked.

It seems there is a considerable loss of smoothness when moving to the runtime engine with respect to the hosted solution. Is this so? or am I missing some things? or making things the wrong way?

Regarding the first two attempts, is there any way to make them work?, or these are just dead ends? Does the fact of the Docker container could have something to do with it?

Thank you!!!