How do I send email using logic app by passing user id , subject , attachment from databricks

558 views Asked by At

Need to send email to a list of user from databricks , since we do not have a SMTP server setup we need to use the Logic app to do the task. Is there a way to call the logic app to send the mail we can pass the userid , subject and attachments from databricks(azure blobs)

Since this is a new territory for me and i can not see any ongoing threads or material so posting this question

1

There are 1 answers

0
SwethaKandikonda On

One way to make this work is that you can use a regular Rest Api POST call to send the data from databricks to logic apps. And from there you can send the emails using the related connector.

import requests

url = "<Your_Logic_App_URL>"
myResponse = requests.post(url,data={"emailId":"<Your_User_Id>" , "subject":"<Your_Subject>" , "attachment":"<Your_Attachments>"})

To automate this, I have used When a HTTP request is received with a sample payload to generate schema which generates outputs parameters which can be used to send emails in my logic apps. Below is the flow in my logic apps.

enter image description here