Hi I am new to logic apps. I have a python code for sending mail with attachments using Azure Logic Apps. When I provide a static file path in Get Blob Content the mail is working fine with the attachment. But when I am trying to the send the file path dynamically from azure databricks it is not receiving at the get blob content in logic app. I have also tried few examples using initialise variables but it is not working.
import requests
def send_email(_to, _subject, _body, file):
email_body = "{0} <br><br><br> <h6> Hi Hello World </h6>".format(_body)
task = { "body_data_1": email_body , "subject_name_1": _subject , "email_to_list_1": _to, "attach" : file }
logic_app_post_url = 'https://prod-27.centralindia.logic.azure.com:443/workflows/*****'
resp = requests.post(logic_app_post_url, json=task)
print(resp.status_code)
if resp.status_code == 202:
print('Email Sent!')
email_to = "abc@outlook.com"
email_subject = "Testing Logic App Send Mail with Dynamic File"
email_body = "Hi This is a test mail Dynamic"
file_path = "/super-store/output/orders/_SUCCESS"
send_email(email_to, email_subject, email_body, file_path)
Logic App Design
Logic App Run Error Details
We have observed Get Blob Content (V2)
is being used to send the attachments dynamically from azure Data bricks. Instead, we suggest using Get Blob Content using Path(V2) connector.
Wherein Get Blob Content (V2)
connector will retrieve blob contents using id and Get Blob Content using Path (V2)
connector retrieves blob contents using path.
Example with snippets:
Result: