package googleapi import ( "fmt" "gogs.mikescher.com/BlackForestBytes/goext/tst" "os" "testing" ) func TestEncodeMimeMail(t *testing.T) { mail := encodeMimeMail( "noreply@heydyno.de", []string{"trash@mikescher.de"}, nil, nil, "Hello Test Mail", MailBody{Plain: "Plain Text"}, nil) fmt.Printf("%s\n\n", mail) } func TestEncodeMimeMail2(t *testing.T) { mail := encodeMimeMail( "noreply@heydyno.de", []string{"trash@mikescher.de"}, nil, nil, "Hello Test Mail (alternative)", MailBody{ Plain: "Plain Text", HTML: "
Non Plain Text", }, nil) fmt.Printf("%s\n\n", mail) } func TestEncodeMimeMail3(t *testing.T) { mail := encodeMimeMail( "noreply@heydyno.de", []string{"trash@mikescher.de"}, nil, nil, "Hello Test Mail (alternative)", MailBody{ HTML: "Non Plain Text", }, []MailAttachment{ {Data: []byte("HelloWorld"), Filename: "test.txt", IsInline: false, ContentType: "text/plain"}, }) fmt.Printf("%s\n\n", mail) } func TestEncodeMimeMail4(t *testing.T) { b := tst.Must(os.ReadFile("/home/mike/Pictures/Screenshot_20220706_190205.png"))(t) mail := encodeMimeMail( "noreply@heydyno.de", []string{"trash@mikescher.de"}, nil, nil, "Hello Test Mail (inline)", MailBody{ HTML: "Non Plain Text", }, []MailAttachment{ {Data: b, Filename: "img.png", IsInline: true, ContentType: "image/png"}, }) fmt.Printf("%s\n\n", mail) }