1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-18 10:07:02 +00:00

Started work on MIME parser

I'm hoping to mostly rely on the official mime and mime/multipart
packages, but Inbucket is still going to have to decided what to
do with the various parts it reads.
This commit is contained in:
James Hillyerd
2012-10-14 23:11:39 -07:00
parent da8e0bc508
commit 46b123606b
3 changed files with 163 additions and 0 deletions

28
app/inbucket/mime_test.go Normal file
View File

@@ -0,0 +1,28 @@
package inbucket
import (
"bufio"
"net/mail"
"os"
"testing"
)
func TestSomething(t *testing.T) {
// Open test email for parsing
raw, err := os.Open("../../test-data/html-mime-attach.raw")
if err != nil {
t.Fatalf("Failed to open test data: %v", err)
}
// Parse email into a mail.Message object like we do
reader := bufio.NewReader(raw)
msg, err := mail.ReadMessage(reader)
if err != nil {
t.Fatalf("Failed to read message: %v", err)
}
_, err = ParseMIMEMessage(msg)
if err != nil {
t.Fatalf("Failed to parse mime: %v", err)
}
}