Sendgrip API - use html file as body of email?

Hi everyone,

I don’t know if it’s related, but since Wappler move to phpMailer my Sengrid smtp relay has been failing well over 50% of the time, with no errors displayed anywhere - it’s just as if the request never reached their smtp relay.

I’m therefore attempting to move to their API, which is unchartered territory for me (I’m not a good coder and illiterate with Json). I’ve got the basics done in terms of calling the API and setting the headers:

My next step is to set-up the JSON data with personalization, which will include the sender’s email address from a dynamic source (I see the editor in wappler facilitates this fairly easily), the email subject, and particularly, and HTML body. For the latter, I am trying to achieve the same that the send mail step facilitated, which is to send an HTML file as the email body:

image

I have not found any documentation on how to achieve this through the sengrid API, and I’m also getting multiple formatting errors as I try to learn proper JSON, making the task more challenging for something that seems fairly simple.

I wonder if anyone had a sample that I could use for guidance?

Many thanks,
Nathaniel.

Community Page
Last updated: