Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - vanng822/go-premailer: Inline styling for html mail in golang

Inline styling for html mail in golang. Contribute to vanng822/go-premailer development by creating an account on GitHub.

Visit SiteGitHub - vanng822/go-premailer: Inline styling for html mail in golang

GitHub - vanng822/go-premailer: Inline styling for html mail in golang

Inline styling for html mail in golang. Contribute to vanng822/go-premailer development by creating an account on GitHub.

Powered by 0x5a.live ๐Ÿ’—

go-premailer

Inline styling for HTML mail in golang

Document

GoDoc Go Report Card

install

go get github.com/vanng822/go-premailer/premailer

Example

import (
	"fmt"
	"github.com/vanng822/go-premailer/premailer"
	"log"
)

func main() {
	prem, err := premailer.NewPremailerFromFile(inputFile, premailer.NewOptions())
	if err != nil {
		log.Fatal(err)
	}
	
	html, err := prem.Transform()
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(html)
}

Input

<html>
<head>
<title>Title</title>
<style type="text/css">
	h1 { width: 300px; color:red; }
	strong { text-decoration:none; }
</style>
</head>
<body>
	<h1>Hi!</h1>
	<p><strong>Yes!</strong></p>
</body>
</html>

Output

<html>
<head>
<title>Title</title>
</head>
<body>
	<h1 style="color:red;width:300px" width="300">Hi!</h1>
	<p><strong style="text-decoration:none">Yes!</strong></p>
</body>
</html>

Commandline

> go run main.go -i your_email.html
> go run main.go -i your_mail.html -o process_mail.html

GoLang Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.