google mail API [[FIN]]
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m28s
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m28s
This commit is contained in:
77
googleapi/mimeMessage_test.go
Normal file
77
googleapi/mimeMessage_test.go
Normal file
@@ -0,0 +1,77 @@
|
||||
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: "<html><body><u>Non</u> Pl<i>ai</i>n T<b>ex</b>t</body></html>",
|
||||
},
|
||||
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: "<html><body><u>Non</u> Pl<i>ai</i>n T<b>ex</b>t</body></html>",
|
||||
},
|
||||
[]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: "<html><body><u>Non</u> Pl<i>ai</i>n T<b>ex</b>t</body></html>",
|
||||
},
|
||||
[]MailAttachment{
|
||||
{Data: b, Filename: "img.png", IsInline: true, ContentType: "image/png"},
|
||||
})
|
||||
|
||||
fmt.Printf("%s\n\n", mail)
|
||||
}
|
Reference in New Issue
Block a user