Skip to content

giraffate/rfc2822

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

rfc2822

Usage

func main() {
	headers := map[string]string{
		"From":         "Sample",
		"Subject":      "Test",
		"Content-Type": "text/html; charset=UTF-8",
	}
	body := "<html><body>test</body><html>"
	m := rfc2822.Message{Headers: headers, Body: body}

	fmt.Println(m.Create())
}
From: Sample
Subject: Test
Content-Type: text/html; charset=UTF-8

<html><body>test</body><html>

Use no-ASCII header

func main() {
	headers := map[string]string{
		"From":         "Sample",
		"Subject":      rfc2822.Encode(rfc2822.UTF8, []byte("テスト")),
		"Content-Type": "text/html; charset=UTF-8",
	}
	body := "<html><body>test</body><html>"
	m := rfc2822.Message{Headers: headers, Body: body}

	fmt.Println(m.Create())
}
From: Sample
Subject: =?UTF-8?B?44OG44K544OI?=
Content-Type: text/html; charset=UTF-8

<html><body>test</body><html>

Releases

No releases published

Packages

No packages published

Languages