cancel
Showing results for 
Search instead for 
Did you mean: 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to access smtplib with ACL enables cluster

unalluri9999
New Contributor

I am having a tough time to connect to smtp server from databricks with ACL enabled cluster , I am able to access with out ACL enabled cluster what can be done to access it via ACL enabled cluster 

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
# Configuring SMTP server settings
smtp_server = "xxxx"
port = 25 # For starttls
sender_email = "xxxx"
receiver_email = "xxxx"
#password = dbutils.secrets.get(scope="your_scope", key="smtp_password")
# Creating the email message
message = MIMEMultipart()
message["From"] = sender_email
message["To"] = receiver_email
message["Subject"] = "Test email from DataBricks"
body = "This is a test email sent from a DataBricks notebook."
message.attach(MIMEText(body, "plain"))
# Sending the email
server = smtplib.SMTP(smtp_server, port)
server.starttls()
#server.login(sender_email, password)
server.sendmail(sender_email, receiver_email, message.as_string())
server.quit()
1 REPLY 1

szymon_dybczak
Contributor III

Hi @unalluri9999 ,

What error do you get? By ACL you mean IP access lists or something different? Your workspace is vnet injected?