title: Send mail with smtplib works when deployed in local but fails when deployed in swarm (Cannot assign requested address)
body: <p>We have a container with a python flask service that listens in the port 5000. We need to be able to send notification emails from that container to smtp.office365.com to the port 587.</p>
  
  <p>This container, when deployed in a local machine works perfectly, but when deployed in a swarm server the following error code is returned: [Errno 99] Cannot assign requested address</p>
  
  <p>From the information I've found, I'm guessing there is a problem with the configuration of the outgoing connection when sending the email, but I'm still not sure about what extra configuration does the container need for sending the email when deployed in a swarm when compared to deploying in local.</p>
  
  <p>In the dockerfile, only the 5000 port is exposed and binded to the flask server.</p>
  
  <p>When sending the email with smtplib, only the port of the smtp server is required to be specified (587 in my case).</p>
  
  <p>What could I be missing? Do I need to expose new ports for this? Could be a problem with binding to localhost? I don't have a clear picture of the path the mail follows since it's sent from my python code until it arrives to the smtp server.</p>