Skip to content

Instantly share code, notes, and snippets.

View tientp-floware's full-sized avatar
🎯
Focusing

Tiến Trần tientp-floware

🎯
Focusing
View GitHub Profile
@tientp-floware
tientp-floware / mail-attachment.go
Last active March 5, 2020 08:47
Email attachment and got body.
package main
import (
"crypto/tls"
"fmt"
"io"
"io/ioutil"
"log"
"github.com/emersion/go-imap"
import "bytes"
func StreamToByte(stream io.Reader) []byte {
buf := new(bytes.Buffer)
buf.ReadFrom(stream)
return buf.Bytes()
}
func StreamToString(stream io.Reader) string {
buf := new(bytes.Buffer)