When sending a SMTP email. How do I pass in the JSON payload and the template?
I can create my own custom Email body but I want to use a template in HubSpot and then populate the body dynamically.
I am using C# and have the following
MailMessage mm = new MailMessage();
SmtpClient smtp = new SmtpClient();
mm.From = new MailAddress(“doNotreply@xx.ai”, “xx.ai daily report”, System.Text.Encoding.UTF8);
mm.To.Add(new MailAddress(SubScriberEmail));
mm.Subject = "Daily Foot Traffic Report " + myDateToShowInEmail;
//mm.body =“Commented out to use a template”;
smtp.Host = “smtp.hubapi.com”;
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = “fakeuser”;//
NetworkCred.Password = “fakePassword”;// password
// smtp.UseDefaultCredentials = ;
smtp.Credentials = NetworkCred;
//587 (for STARTTLS) or 465 (for TLS)
smtp.Port = 587; //Gmail port for e-mail 465 or 587
smtp.Send(mm);
I tried passing in a header, but that didn’t work.
mm.Headers.Add(“X-HubSpot-Template-Id”, “142328127660”); //didn’t work