Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vanng822/go-premailer

Inline styling for html mail in golang
https://github.com/vanng822/go-premailer

email golang html inline-css inline-styles mail premailer

Last synced: 7 days ago
JSON representation

Inline styling for html mail in golang

Awesome Lists containing this project

README

        

# go-premailer

Inline styling for HTML mail in golang

# Document
[![GoDoc](https://godoc.org/github.com/vanng822/go-premailer/premailer?status.svg)](https://godoc.org/github.com/vanng822/go-premailer/premailer)
[![Go Report Card](https://goreportcard.com/badge/github.com/vanng822/go-premailer)](https://goreportcard.com/report/github.com/vanng822/go-premailer)

# 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



Title

h1 { width: 300px; color:red; }
strong { text-decoration:none; }



Hi!


Yes!



## Output



Title


Hi!


Yes!



# Commandline

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