Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.

Alteryx Designer Desktop Ideas

Share your Designer Desktop product ideas - we're listening!
Submitting an Idea?

Be sure to review our Idea Submission Guidelines for more information!

Submission Guidelines

Email Tool Enhancement (Reporting Palette)

It would be good if the Email Tool could be enhanced so that it can send HTML e-mails, by that I mean the body of the e-mail is HTML based on a field in the workflow that contains a string of HTML. 

 

Currently we are having to use batch files with command line e-mail clients to send e-mail with HTML generated within Alteryx workflows.

31 Comments
DataSetGo
6 - Meteoroid

@

@

 

 

 

 

klonergan
8 - Asteroid

This is desperately needed.  There should be an ability to send html e-mail.  The solution from brian_scott noted above works, but it doesn't allow embedded images.  And so I'm still having to use a third party e-mail tool (blat) to get decent looking messages.  

michael_heitz
8 - Asteroid

OK, very curious on this... I put the HTML in between the [] as instructed... but the email I got basically just shows all the raw HTML code... not sure wemail receivedemail receivedemail tool with html pasted inemail tool with html pasted inhat I am doing wrong. Here is a pic of part of the email received

harvjul
8 - Asteroid

@DataSetGo 

Could you help me out with what you did for the workflow?  I had the workflow running well with standard text and dynamic fields to multiple email addresses.  I also have a workflow running well separately that sends 1 HTML email.  But I'm having difficulties combining the 2 ideas. 

When I copy the HTML in the separate flow to the workflow that sends to a distribution list, I get an Alteryx Designer error that an Unhandled Exception occurred.

jason_scarlett
10 - Fireball
harvjul
8 - Asteroid

@jason_scarlett 

  1. I have the standalone workflow example you linked that sends 1 HTML email.  I can get this to work without any errors.
  2. I also have another workflow that sends text, a table, and dynamic fields to a distribution list that runs with no errors.

When I combine the 2 flows and copy the HTML in the standalone workflow into the workflow that sends to a distribution list, I get an Alteryx Designer error that an "Unhandled Exception occurred."

 

I'm looking for help with what @DataSetGo  mentioned here: 

"I had some more time with this code today and got it to work. I was also able to integrate a table tool and two additional text tools into the workflow so that the body of the email was even more customized to include dynamic data per individual recipient!"

klonergan
8 - Asteroid

Another option now would be to use the python tool as this can be done without any additional installation/libraries.  If you had an incoming data-stream with a column called 'Email' and a column called 'Comment', then the following code would send an e-mail for each row with the comment column dynamically updated.    

 

#################################
# List all non-standard packages to be imported by your
# script here (only missing packages will be installed)
from ayx import Package, Alteryx
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart


#################################
df = Alteryx.read("#1")
sender = 'test_sender@gmail.com'
smtp_host = 'your.smtp.host'
smtp_port = 25

# Create the body (plain-text and HTML version)
text = """\
Get a new e-mail client that supports html"""
html = """\
<html>
<body>
<p>Hi,<br>
<b>test html version</b><br>
<h1>this is a header</h1>
<p>$COMMENT%</p>
<a href="http://www.google.com">A google link</a>
</p>
</body>
</html>
"""

server = smtplib.SMTP(smtp_host, smtp_port) # your smtp server, may need to use SSL etc
# now set dynamic content and send for each row in df
for index, row in df.iterrows():
msg = MIMEMultipart("alternative")
msg['Subject'] = "Test HTML Message with Alteryx/Python"
msg['From'] = sender
recipients = [row['Email']]
msg['To'] = ", ".join(recipients)
html_new=html.replace('$COMMENT%', row['Comment'])
# Turn these into plain/html MIMEText objects
part1 = MIMEText(text, "plain")
part2 = MIMEText(html_new, "html")

# Add HTML/plain-text parts to MIMEMultipart message
# The email client will try to render the last part first
msg.attach(part1)
msg.attach(part2)

# Create secure connection with server and send email
server.sendmail(sender, recipients, msg.as_string())
server.quit()

 

#################################

 

 

 

jason_scarlett
10 - Fireball

@harvjul I would follow up with @DataSetGo on what they are doing. I don't use the table or text tools.

 

My best guess is that the <html>  ... </html> content you create is either badly formatted, or not valid. Can you save the resulting <html> content to a *.html file and open it in a browser?

harvjul
8 - Asteroid

I'm going to check out the Python answer next week.

 

The HTML works perfectly in a standalone workflow that doesn't email to a distribution list.  It is only when you paste the same HTML code into the distribution list workflow that the error is thrown.  

 

I am hoping @DataSetGo or another user has a good, complex example with multiple reporting parts for HTML emailing.

KylieF
Alteryx Community Team
Alteryx Community Team
Status changed to: Not Planned

Thank you for posting to the Alteryx Community! Your idea is interesting to us, however we have determined that we are unable to place this idea on our road map for the product due to several factors. However should we be able to return to your idea in the future we will update the status back to Under Review.