refactor: project structure

This commit is contained in:
2023-10-21 20:31:31 +02:00
parent 1bbdbf751b
commit fc005a74c3
12 changed files with 215 additions and 104 deletions

26
pkg/email/message.go Normal file
View File

@@ -0,0 +1,26 @@
package email
import (
"fmt"
"io"
)
type EmailMessage struct {
To string
Subject string
Body string
Attachments []EmailAttachment
}
type EmailAttachment struct {
File io.Reader
Title string
}
func (e EmailAttachment) ReadContent() ([]byte, error) {
bts, err := io.ReadAll(e.File)
if err != nil {
return nil, fmt.Errorf("error loading attachment: %s", err)
}
return bts, nil
}