Ecosyste.ms: Awesome

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

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: 24 days ago
JSON representation

Inline styling for html mail in golang

Lists

README

        

# go-premailer

Inline styling for HTML mail in golang

# Document
[![Build Status](https://travis-ci.org/vanng822/go-premailer.svg?branch=master)](https://travis-ci.org/vanng822/go-premailer)
[![GoDoc](https://godoc.org/github.com/vanng822/go-premailer/premailer?status.svg)](https://godoc.org/github.com/vanng822/go-premailer/premailer)
[![GoCover](http://gocover.io/_badge/github.com/vanng822/go-premailer/premailer)](http://gocover.io/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

# Demo

http://premailer.isgoodness.com/

# Conversion endpoint

http://premailer.isgoodness.com/convert

request POST:
html: your mail
cssToAttributes: true|false
removeClasses: true|false
response:
{result: output}