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: 9 days ago
JSON representation
Inline styling for html mail in golang
- Host: GitHub
- URL: https://github.com/vanng822/go-premailer
- Owner: vanng822
- License: mit
- Created: 2015-02-16T22:19:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-07-08T23:56:31.000Z (4 months ago)
- Last Synced: 2024-07-31T20:51:17.133Z (3 months ago)
- Topics: email, golang, html, inline-css, inline-styles, mail, premailer
- Language: Go
- Homepage:
- Size: 113 KB
- Stars: 136
- Watchers: 4
- Forks: 19
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - go-premailer - Inline styling for HTML mail in Go. (Email / Search and Analytic Databases)
- awesome-go-extra - go-premailer - 02-16T22:19:18Z|2021-03-06T20:26:39Z| (Email / Advanced Console UIs)
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