Last modified date: 20 Jul 2023
Environment
- Tableau Server
Answer
Tableau Server all Versions
This example uses email shareware called febootimail, but any email client such as Google G-suite or AWS Simple Email Service (SES) can be used.To generate a PDF, type the following command:
tabcmd get "<url-of-view>.pdf" -f "<filename>.pdf"
Replace <url-of-view>
with the view's URL path after it has been published.
For example, the tabcmd command may look like this:
tabcmd get "/views/Wow/SummaryReports.pdf" -f "progressReport.pdf"
If the PDF generates successfully, tabcmd places the PDF file "progressReport.pdf" in the current working directory.
Use tabcmd to send email messages with attachments
This example uses email shareware called febootimail, which allows full control over all aspects of email generation. (See Related Links below.)
This example sends the PDF progress report you generated as an e-mail attachment.
tabcmd login -s http://tableauserver:80 -u admin -p admin
tabcmd get "/views/Wow/SummaryReports.pdf" -f "progressReport.pdf"
febootimail.exe -SMTP yourSMTPhost.yourcompany.com -TO "recipient1@yourcompany.com; recipient2@yourcompany.com;recipient3@yourcompany.com" -FROM sender@yourcompany.com -SUBJECT "Generated Tableau View - Tableau Server Automated Alert System (TSAAS)" -ATTACH " C:\Program Files\Tableau\Tableau Command Line\progressReport.pdf" -BODY " this is the text of the body"
Use tabcmd to send formatted email with embedded images
Tabcmd can generate PNG files, and febootimail can send HTML e-mail. The HTML file must be in the same directory as febootimail.
This example sends a PNG image of the progress report view you generated as an e-mail attachment.
tabcmd login -s http://tableauserver:80 -u admin -p admin
tabcmd get "/views/Wow/SummaryReports.png" -f "progressReport.png"
febootimail.exe -SMTP yourSMTPhost.yourcompany.com -TO "recipient1@yourcompany.com; recipient2@yourcompany.com;recipient3@yourcompany.com" -FROM sender@yourcompany.com -SUBJECT "Generated Tableau View - Tableau Server Automated Alert System (TSAAS)" - -HTMLFILE "emailbody.html"
Notice that the BODY tag has been replaced by an HTMLFILE tag. Because tabcmd can auto-generate a PNG image, you can reference that image in the body of an HTML email template, as shown below:
<html>
<head><title>Email Alert</title></head>
<body><img src="progressReport.png"></body>
</html>
Additional information
If you install febootimail and review its help files, you will note the following:
- Instead of typing the e-mail addresses of recipients using the TO tag, you can refer to a file.
- Instead of typing the e-mail body using the BODY tag, you can specify an HTMLFILE tag.
- You can attach multiple files.
These features provide control over the Tableau generation and e-mail process. Many other applications and scripting languages also have this type of support.
- While the tabcmd by itself cannot send email messages, you can configure email alerts to be generated if there is a system failure or for sending out notifications that allow users to subscribe to their favourite views. For more information about these features, refer to the Email Alerts/Subscriptions topic in the Server Online Help.
- Febooti Commandline Email: http://www.febooti.com/products/command-line-email/