HTML email
Build the plain-text and HTML alternatives of a multipart email from the same input. Pass the HTML fragment to the email template and use the text version for readers that prefer it.
Result
The HTML fragment wraps “Ship” in a strong element. Use the plain text from the same draft for the other MIME alternative. Your mail client supplies the headers and sends the message.
Code examples
TypeScript
import { convert } from "mdto-messages";
const draft = convert("**Ship** today", "email");
console.log(draft.html);Python
from mdto_messages import convert
draft = convert("**Ship** today", "email")
print(draft.html)Go
package main
import (
"fmt"
"log"
"github.com/jmeinke/mdto-messages"
)
func main() {
draft, err := mdto.Convert("**Ship** today", mdto.Email)
if err != nil {
log.Fatal(err)
}
if draft.HTML != nil {
fmt.Println(*draft.HTML)
}
}Format an email draft in your browser