cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How can I send custom email notification

keeplearning
New Contributor II

I am using the edit notification in databricks to send email notification in case of workflow failure or success. How can I add additional information to this report for example if I want to notify about number of rows got processed or added how can I do this

1 ACCEPTED SOLUTION

Accepted Solutions

LandanG
Databricks Employee
Databricks Employee

@Rohit Kapoorโ€‹ If you want more control over notifications I'd check out Alerts in DB SQL. You can set custom Alert Destinations and create SQL queries for fine-grained control. For example, you can jobs to schedule a DLT pipeline to run and then trigger an alert right after to send an email with how many rows were processed or how many rows failed.

View solution in original post

4 REPLIES 4

RKNutalapati
Valued Contributor

Hi @Rohit Kapoorโ€‹ :

There is a new format for job emails, this can be enabled from Admin console -> Workspace settings

imageI think any additional information apart from above image can be appended to the error message in catch block of your program.

Another option is to implement a function to send mails, so you can customize your message and send it on success/ failure.

Hope this helps

Thanks,

RKNutalapati

LandanG
Databricks Employee
Databricks Employee

@Rohit Kapoorโ€‹ If you want more control over notifications I'd check out Alerts in DB SQL. You can set custom Alert Destinations and create SQL queries for fine-grained control. For example, you can jobs to schedule a DLT pipeline to run and then trigger an alert right after to send an email with how many rows were processed or how many rows failed.

Yash-Verma
New Contributor II

I am trying alerts option to send an email but when I am trying to add email address in destination it is not allowing me to add. Only user id it is allowing. Please help. Also, I am trying to send emails directly from notebooks using SMTP server provided by my company but again timeout error is coming

Panda
Valued Contributor

@keeplearning 

There are three approaches I can think of for this:

Approach 1: Creating an email template and sending emails programmatically from DBX Notebook.
Approach 2: Invoke a Logic App via an Azure REST API from Databricks after the code executes successfully or in the failure (catch) block.
Approach 3: Invoke a Webhook that internally triggers a Logic App to send an email using a predefined template.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group