Use tabcmd to send email messages
While the tabcmd by itself cannot send email messages, if you are using Tableau Server 8.0 and alter, you can configure email alerts if there is a system failure or subscriptions that allow users to subscribe to their favorite views. For more information about these features, refer to the Email Alerts/Subscriptions topic in the Server Online Help. Alternatively, you can easily add this functionality through scripting. Many applications and scripting languages are available, and you can combine the printing automation of tabcmd with practically any other logic. Two examples illustrate this capability.
This example uses email shareware called febootimail.exe (search the Web for "febootimail" for more information). This program allows full control over aspects of the e-mail generation.
Here is an example that sends as an e-mail attachment the PDF progress report you generated in the last example.
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"
If you install febootimail and review its help files, you can 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.
Send formatted e-mail with a Tableau picture embedded
Tabcmd can generate PNG files, and febootimail.exe can send HTML e-mail. The febootimail help says that the HTML file must be in the same directory as febootimail.
Here is an example script:
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. Here is a simple version of this HTML file:
