Survey banner
The Dataiku Community is moving to a new home! Some short term disruption starting next week: LEARN MORE

Send Emails from Dataiku Flows with Options to format the Content

Prakhyath
Level 3
Send Emails from Dataiku Flows with Options to format the Content

Hi Team,

We are working on a project which requires an option to send emails by formatting their style suits like colour coding, adding header and footer, attaching the data from flow as pdf doc, etc. These features are already existing in ETL tools like Alteryx. 

Since Dataiku doesn't have any native recipe or full fledged plugin to accomplish this task, I would request any suggestions or guidance to fulfil this requirement.

Current Plugin from Dataiku: Send Emails (Plugin: Send Emails | Dataiku - Your Path to Enterprise AI)

 

Thanks & Regards,

Prakhyath


Operating system used: Windows 64 bit

0 Kudos
11 Replies
Grixis6
Level 3

Hello @Prakhyath ,

I'm not sure I understand exactly your need but if you want send : by email a personalized document with your data set and other information such as KPIs etc.

I think this alternative can meet your needs:

Create a dashboard that you have personalized with your custom data (by publish function), then you make a scenario that updates it and sends it in pdf format, for example, to your email box. 🙂

 

 

0 Kudos
Prakhyath
Level 3
Author

Hello @Grixis6 

Thanks for your Time!

Currently we are following the same approach of triggering email with customized body editing using a python recipe, I wanted to check if we have any updated or new plugin apart from "Send Emails" plugin which would get this job accomplished.

In Dataiku currently we have two possible ways of doing this task,

* Using "Send Emails" Plugin - Plugin: Send Emails | Dataiku - Your Path to Enterprise AI

* Send Message from Scenario Step where we can either embed HTML script with inline body option along with sending data as an attachment

Unfortunately both these options are not aiding my usecases, so currently the usecases are facilitated with a custom python script.

Turribeach

You can also send an email from Scenario Step:

https://doc.dataiku.com/dss/latest/scenarios/reporters.html

 

0 Kudos
Prakhyath
Level 3
Author

Hello @Turribeach 

Thanks for your Time!

In Dataiku currently we have two possible ways of doing this task,

* Using "Send Emails" Plugin - Plugin: Send Emails | Dataiku - Your Path to Enterprise AI

* Send Message from Scenario Step where we can either embed HTML script with inline body option along with sending data as an attachment

Unfortunately both these options are not aiding my usecases, so currently the usecases are facilitated with a custom python script.

0 Kudos

Hi, if you have solved the problem with a custom script then why do you ask the question? Is there something that your solution can't accomplish? (then you should explain that). Also when you say "these options are not aiding my usecases" is not really clear what the problem is. What specific requirement you are unable to meet and why. In any case looks like you are sorted for now. Thanks

0 Kudos
Prakhyath
Level 3
Author

Hi,

Missed to add a point that we are going for developing custom plugin's if required with this python script to enhance the usability of this feature (As per client needs).

0 Kudos
Prakhyath
Level 3
Author

Hi,

We have the solution in python recipe and our clients were eager to have it as a visual recipe or DSS native plugin, the scenario is replicating existing Alteryx flows which have recipe's to format table, add headers and footers etc. So was trying to see if I have missed on any visual recipe options which would cater this need.

Any ways since we don't have any visual recipe's yet in this regards we have to proceed with utilizing python script.

Thanks again for timely response and guidance.

0 Kudos
Samy1
Level 1

Hello Prakhyat,

I am new to dataiku and for one of our requirement I need to trigger email using python script.

Could you please help me to know the exact code you are using to accomplish this email trigger task using python script?

 

0 Kudos
Prakhyath
Level 3
Author

Hi,

I had used MIME python packages,

from email.mime.application import MIMEApplication

from email.mime.multipart import MIMEMultipart

from email.mime.text import MIMEText

import smtplib

The module is framed is attached in the screenshot.

SEND_FROM / send_to / cc_to -> comma separated emails in '<email1>,<email2>' format.

 

 

 

 

0 Kudos

Useful but it will be much better if you post your code using a code block (<>) so the person can copy the code. I have used TextSniper on my Mac to get this converted back to text but I can't confirm it works.

def send_dataframe(send_to,cc_to, subject, body, df):
    multipart = MIMEMultipart
    multipart|'From'] = SEND_FROM
    multipart|'To'] = send_ _to
    multipart|'Cc'] = cc_to
    multipart|'Subject'] = subject
    rept = cc_to.split(,) + send_ _to.split(,)
    for filename in EXPORTERS:
        attachment = MIMEApplicationEXPORTERS|filename](df))
        attachment|'Content-Disposition'] = 'attachment; filename=" ''.format(filename)
        multipart.attach (attachment)
    multipart.attach (MIMEText(body, 'html))
    s= smtplib.SMTP(localhost')
    s.sendmail(SEND_FROM, rcpt, multipart.as_string))
    s.quitO

 

0 Kudos
Turribeach

Ah OK. Well if you have a Python recipe you are not too far from a Python Plugin recipe. 🙂