TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
Sending Tables in Sendgrid Mail via TeamDesk
Hello to you all

With Teamdesk you can setup in no time e-mail alerts including text and attachments, and this is very handy.

If you want to control the email originator (neither Teamdesk nor dbflex) and improve the visual aspect of the mail, you have to use an email service provider such as Sendgrid, which TeamDesk controls efficiently using apis.

I would like to send tables (ex 4 columns / X lines) generated in TeamDesk via Sendgrid and I do not know how to do it.

I am sending many mails using Sendgrid, includes text, attachments, images, ...
I can form a table in CSV format
I do not know how to send the table in a clean format via Sendgrid. I expect I have to convert it into some kind of html, but I have no experience there.

Has any of you experience there ? or any idea on where to dig to find a way ?

Kind regards,

Pierre
ID
1482
Category
Integration/API
Author

Pierre
Date Created
11/17/2021 4:32:01 AM
Date Updated
2/1/2022 3:41:29 PM
Comments
cooper collier  11/17/2021 8:00:02 AM
I have done something similar, but not with sendgrid. The service I have been using is https://www.paubox.com
There API is dirt simple. They encrypt the emails with HIPAA compliance. Plus they are inexpensive.

This it the CallURL body I send to them.
The Teamdesk codes will likely be similar for Sendgrid..

ps... remember if you're sending with the clients email as the from, make sure you have the client update there spf records.


{
"data": {
"message": {
"recipients": [
<%=[TEMP Email Notes To (only 1 address at a time)]%>
],
"headers": {
"subject": "<%[Email Subject]%>",
"from": "me@sample.com",
"reply-to": "me.samle.com"
},
"allowNonTLS": false,
"forceSecureNotification": false,
"content": {
"text/html": "<%[Email Message (use the ? for formatting)]%>"
},
"attachments": [
{"fileName": <%=FileName([Temp Encrypt File 1])%>, "contentType": <%=FileType([Temp Encrypt File 1])%>, "content": <%=[Temp Encrypt File 1]%> }
<%? not IsNull([Temp Encrypt File 2]) %>, {"fileName": <%=FileName([Temp Encrypt File 2])%>, "contentType": <%=FileType([Temp Encrypt File 2])%>, "content": <%=[Temp Encrypt File 2]%> }<%?%>
<%? not IsNull([Temp Encrypt File 3]) %>, {"fileName": <%=FileName([Temp Encrypt File 3])%>, "contentType": <%=FileType([Temp Encrypt File 3])%>, "content": <%=[Temp Encrypt File 3]%> }<%?%>
<%? not IsNull([Temp Encrypt File 4]) %>, {"fileName": <%=FileName([Temp Encrypt File 4])%>, "contentType": <%=FileType([Temp Encrypt File 4])%>, "content": <%=[Temp Encrypt File 4]%> }<%?%>
<%? not IsNull([Temp Encrypt File 5]) %>, {"fileName": <%=FileName([Temp Encrypt File 5])%>, "contentType": <%=FileType([Temp Encrypt File 5])%>, "content": <%=[Temp Encrypt File 5]%> }<%?%>
<%? not IsNull([Temp Encrypt File 6]) %>, {"fileName": <%=FileName([Temp Encrypt File 6])%>, "contentType": <%=FileType([Temp Encrypt File 6])%>, "content": <%=[Temp Encrypt File 6]%> }<%?%>


]
}
}
}
Pierre 11/19/2021 6:12:44 AM
Hello Cooper

Thanks a lot for your answer which seems very actionable

[I have not been able to test it for the last couple of days / some business came in]
[sorry for answering late]

I will write back as soon as I have dealt with it

Pierre
Pierre 2/1/2022 4:09:55 AM
Hello Cooper

I came back at this subject and reviewed your message - thanks again for it.
The code to send the email with Paubox is very much equivalent to Sendgrids.

Could you show me your "[Email Message (use the ? for formatting)]" code or logic ?
More specifically the part about tables.

What I do is the following:
- I use TeamDesk Select method with a .html output to recover the html table content ( <table>... <thead>...). I place the html code in a TeamDesk variable.
- I insert this code in my SendGrid API request
- Sendgrid sends the mail with the table / BUT / the formatting is lousy (no colors, width issues).

It would be SO NICE if TeamDesk API was upgraded to include the formatting codes (I put it in caps so that maybe TeamDesk will hear).
My intention is to process the html to incorporate some formatting codes.
It is feasible to define 1 style for header / 1 style for the rest of the table.
I would love to use the same style as TeamDesk. I looked at the html code of TeamDesk pages. I could not access the CSS stylesheets.

Kind regards,

Pierre




cooper collier  2/1/2022 8:55:17 AM
That is simply a Text multiline column.
here is a screenshot (I do not know how long the link will be active)
https://prnt.sc/26mylz6

I set it to preformated text.
and then in the help I put the following instructions
------
You can use HTML codes for formatting. Below are the basic codes.
I recommend copy what you write, send a test email to yourself and return.
or use an HTML editor on the web.. ie https://html5-editor.net

<br> new line. (stands for break) You can use multiple to skip a line.

To format text surround the section of text with one of the following.

<h?> ... </h?> Heading (?= 1 for largest to 6 for smallest, eg h1)
<b> ... </b> Bold Text
<i> ... </i> Italic Text
<u> ... </u> Underline Text
Pierre 2/1/2022 9:01:28 AM
Preformatted text... I knew it but never made the link with this issue - What a great idea !
Thanks a lot !

Pierre
Pierre 2/1/2022 3:41:29 PM
Hello Cooper

Did you prepare the html code by hand (with a formula) - or did you get Teamdesk to generate it for you ?
I tried to capture formatted text with TeamDesk in a preformatted multi-line text and failed (I tried html and XML).

My best result so far is to get html text from the Select method (I copy a sample of the answer I got: data, table structure, but no colors / no font weight)

Pierre
----
<table border="1">

<thead>

<tr>

<th>Type</th><th>Fournisseur</th><th>Fournisseur Nom</th><th>Soci&#233;t&#233; Destinataire</th><th>Date de Facture</th><th>N&#176; Facture</th><th>(M)</th><th>Montant HT</th><th>Montant TTC</th><th>Donn&#233;es Facture</th><th>Bon &#224; Payer</th><th>Paiement</th><th>Mt Factur&#233; HT</th><th>Mt Factur&#233; TTC</th>

</tr>

</thead><tbody>

<tr data-id="1593">

<td>Facture</td><td>E-Publication B2B</td><td>E-Publication B2B</td><td>Okimiko</td><td>01/02/2022</td><td>20180072</td><td>€</td><td>290,83</td><td>290,83</td><td>Valid&#233;</td><td>Valid&#233;</td><td>Pas fait</td><td>290,83</td><td>290,83</td>

</tr><tr data-id="1597">

<td>Facture</td><td>EURL YOUTOM</td><td>EURL YOUTOM</td><td>Kaiserspare</td><td>01/02/2022</td><td>F21061</td><td>€</td><td>8,25</td><td>9,90</td><td>Valid&#233;</td><td>Valid&#233;</td><td>Pas fait</td><td>8,25</td><td>9,90</td>

</tr><tr data-id="1598">

<td>Facture</td><td>YouTom</td><td>YouTom</td><td>Studio Vincennes</td><td>01/02/2022</td><td>F21065</td><td>€</td><td>126,00</td><td>151,20</td><td>Valid&#233;</td><td>Valid&#233;</td><td>Pas fait</td><td>126,00</td><td>151,20</td>


Feedback
Back to Search Results