Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ParsedEmail ¶
type ParsedEmail struct { Headers map[string]string Body map[string]string Attachments map[string][]byte // contains filtered or unexported fields }
Example (ParseHeaders) ¶
headers := ` Foo: foo Bar: baz ` email := ParsedEmail{ Headers: make(map[string]string), Body: make(map[string]string), Attachments: make(map[string][]byte), rawRequest: nil, } email.parseHeaders(headers) fmt.Println(email.Headers["Foo"]) fmt.Println(email.Headers["Bar"])
Output: foo baz
Example (ParseRawEmail) ¶
rawEmail := ` To: test@example.com From: example@example.com Subject: Test Email Content-Type: multipart/mixed; boundary=TwiLIo --TwiLIo Content-Type: text/plain; charset=UTF-8 Hello Twilio SendGrid! --TwiLIo Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <html><body><strong>Hello Twilio SendGrid!</body></html> --TwiLIo-- ` email := ParsedEmail{ Headers: make(map[string]string), Body: make(map[string]string), Attachments: make(map[string][]byte), rawRequest: nil, } email.parseRawEmail(rawEmail) for key, value := range email.Headers { fmt.Println(key, value) } fmt.Println(email.Body["text/plain; charset=UTF-8"])
Output: To test@example.com From example@example.com Subject Test Email Content-Type multipart/mixed; boundary=TwiLIo Hello Twilio SendGrid!
func Parse ¶
func Parse(request *http.Request) *ParsedEmail
Click to show internal directories.
Click to hide internal directories.