Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Composer 2 unable to send SMTP emails

Hi Team,

I am struggling in sending a email from cloud-composer 2 environment(

composer-2.0.11-airflow-2.2.3) via smtp.gmail.com.
Please find my configs below :
Note I tried using smtp_password_cmd and smtp_password_secret but both give the same error.

I have also setup a network connectivity test which shows smtp.gmail.com is reachable from my VPC

Error Msg:

File "/opt/python3.8/lib/python3.8/smtplib.py", line 310, in _get_socket
return socket.create_connection((host, port), timeout,
File "/opt/python3.8/lib/python3.8/socket.py", line 808, in create_connection
raise err
File "/opt/python3.8/lib/python3.8/socket.py", line 796, in create_connection
sock.connect(sa)
OSError: [Errno 99] Cannot assign requested address

bajpaid_0-1657023865741.png

Any help/pointers would be appreciated.

Thanks

0 3 1,792
3 REPLIES 3

First please confirm if you set up a Private IP in your composer environment and check if this has connectivity to your API Endpoint? Then follow this document to check the network and the Ip’s of your nodes and pods. If you used a shared VPC do this checklist.You can follow the steps 1-4 in this document, once you are on step 4, you’ll have a terminal on the pod so you can run a command to check the connectivity to the smtp server.

Hi @josegutierrez 
Does it have to do anything with TLS certs ? I am unable to login to k8 cluster. However when I am doing a telnet from cloud shell it reaches to smtp server. telnet smtp.gmail.com 587

Hi Bajpaid , were you able to fix the issue of composer email set up ?

I am also running into same issue , could you please share the solution you implemented ?