I need to be able to add custom HTML emails (that have been dynamically generated) to HubSpot to send as marketing emails.
I had hoped to use this API to do so, but either it only creates a “blank” email from a template that someone then need to manually complete, or I don’t understand the documentation.
Is what I want to do possible, or do I need to move to something like Sendgrid?
Hi @joe12south
The Marketing Email API isn’t really designed for single send email.
So, here’s a few ideas:
- Create a Custom Module, that’s added to a Marketing Email, that displays data from the CRM. That way you can use the same Marketing Email with custom content.
- Create Emails with “programmable content” which is like option 1 but you have more control.
- If you are sending a lot of email you can use HubSpot’s Transaction Emails add-on (paid upgrade). I say lots of emails because it’s too expensive to send just a few emails.
- Send email from your server, from an email account (that’s also a HubSpot User) to log the email to the Contact i.e. use Gmail’s SMTP servers.
- Sendgrid is a great product!
Have fun
Mike
Here to learn more about HubSpot and share my HubSpot Knowledge. I’m the founder of Webalite a Gold HubSpot Partner Agency based in Wellington, New Zealand and the founder of Portal-iQ the world’s first automated HubSpot Portal Audit that helps you work smarter with HubSpot.
Thanks for the response, Mike, though I don’t understand what you mean by “The Marketing Email API isn’t really designed for single send email.”
I finally figured out how to create and populate an email using a template, but I can’t get it to support anything but the most basic html. I’ve tried the rich_text module and the raw_html_email but neither seem to support inline styles.
Mike,
I’m not trying to send volumes of one-to-one emails - I’m creating one email to send to many. This is exactly the use case for marketing emails. It is the content of that one email that needs to be created in an external system.
I finally got this working. For the record for anyone who searches for this in the future:
- You MUST use a template. Ignore any advise suggesting you can create an email on the fly just from raw html with no template. (I wasted hours trying this.)
- You want to populate the raw_html_email module. The rich_text module handles some html, but it won’t work with the core email html building blocks of tables and styles.
- You need to take care encoding your html for JSON transport. New lines, double quotes, etc. Make sure they are all properly escaped. Viewing your email in the HubSpot UI is very helpful for validating if the html is coming across correctly.
- If you do all of the above, even complex nested designs will work, code unmolested.
Hi @joe12south
The Marketing Email API is designed for creating (and cloning) emails for a bulk send e.g. a Newsletter.
If you are sending a one-to-one Email then the Marketing Email API isn’t (in my opinion) the right tool for the job.
You could create a Marketing Email for use in a Workflow, with a Custom Module (that will let you add inline styles*) then you could enroll a Contact in the Workflow to send a one-to-one email (assuming I understand your goal).
Or, another option (if you have an Enterprise Account) is to use the new Single Send API.
Did I add answers? Or create more quesitons? ;o)
Mike