Dewald_Smit | 2023-01-27 00:13:07 UTC | #1
Good day Geniuses,
I need help to understand how the htmlBody string needs to be formatted for the email body to send correctly.
Eos_Rios | 2023-01-27 03:12:03 UTC | #2
{ "senderType": "Outbound", "conversationId": "1", "fromAddress": { "email": "me@here.com", "name": "My Example" }, "toAddresses": [ { "email": "somebody@there.com", "name": "Some Body" } ], "subject": "This is a subject", "htmlBody": "<p>This is some HTML. <i>Behold!</i></p> This is how you escape \"quotes\", which you definitely have to do. Also carriage returns and newlines break stuff." }
Dewald_Smit | 2023-01-27 09:07:41 UTC | #3
Eos_Rios, post:2, topic:18159
<p>This is some HTML. <i>Behold!</i></p> This is how you escape \"quotes\", which you definitely have to do. Also carriage returns and newlines break stuff.
Thanks for this. So how would you add new lines, generate a multiline email body?
Edit: Im being stupid, the p tag should generate a line. if I do this: <p>This is some HTML. <i>Behold!</i></p> This is how you escape \"quotes\", which you definitely have to do. Also carriage returns and newlines break stuff.<p>New Line</p>
It looks like this:
This is some HTML. Behold!
This is how you escape "quotes", which you definitely have to do. Also carriage returns and newlines break stuff.
New Line
The only thing im now not sure about, How to set font, size, color etc?
Eos_Rios | 2023-01-27 14:21:13 UTC | #4
You would handle that through standard css.
<span style="font-size: 10px; color: purple;">This would be an inline 10 pixel tall chunk of text</span>
Following the above rules for escaping your quotes.
If you wanted just a line break by itself with no text that's a break,` <br/>`
Just be aware that various email clients (outlook, gmail, whatever) can do some weird stuff to your styling, especially when it comes to positioning and visibility rules. There are 3rd party sites that do nothing but test your HTML to confirm how it will appear on various tools and any red flags it will throw, but if you keep it simple you shouldn't need those.
system | 2023-03-30 06:27:05 UTC | #7
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 18159