Posts

Showing posts from January, 2023

How to send a list by email in python using Mime Application in Databricks

Image
We have a list: ListA = ['a', 'b', 'c', 'd', 'e'] And we want to send it by email to someone. So what we have to do, first, is save this list as txt file in a temporary location in databricks, and then we open it and put it in a variable, so we can be able to send it by email. Like the example: import boto3 import smtplib import matplotlib.pyplot as plt from email import encoders from email.mime.text import MIMEText from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart from email.mime.application import MIMEApplication server = smtplib.SMTP('smtp-mail.outlook.com:587') #i am using Outlook server.ehlo() server.starttls() server.login('email@outlook.com.br', 'password@97') #Here is your id and password sender = "email@outlook.com.br" #here is your id again recipient = ['destiny@outlook.com.br'] #here the email id from who gonn...