Is it possible to set up an email server in Spaces?

The following code does not seem to work in spaces, although it works on my laptop:

server = smtplib.SMTP("smtp.gmail.com", port=587)
server.starttls()
server.login("<my email>@gmail.com", <my email password>)

It returns the following error:

OSError: [Errno 99] Cannot assign requested address

Thanks for any advice you can provide!