-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathemail.go
56 lines (52 loc) · 1.97 KB
/
email.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"net/mail"
"time"
)
type Account struct {
Server string `json:"server"`
Port int `json:"port,omitempty"`
Username string `json:"username"`
Password string `json:"password"`
Type string `json:"type"`
}
type Message struct {
From string `json:"from"`
To []mail.Address `json:"to"`
CC []mail.Address `json:"cc,omitempty"`
Subject string `json:"subject"`
Body string `json:"body"`
Attachments []string `json:"attachments,omitempty"`
}
type Email struct {
Account Account `json:"account"`
Messages []Message `json:"messages"`
Folder string `json:"folder"`//folder to save the attachements
}
type BodyPart struct {
ContentType string `json:"content_type"`
ContentTypeValue map[string]string `json:"content_type_value"`
Disposition string `json:"disposition"`
DispositionValue map[string]string `json:"disposition_value"`
Charset string `json:"charset"`
FileName string `json:"file_name"`
FileSize int64 `json:"file_size"`
SavedFileName string `json:"saved_file_name"`
SavedFilePath string `json:"saved_file_path"`
Encoding string `json:"encoding"`
ContentId string `json:"content_id"`
Centent string `json:"centent"`
Attachment string `json:"attachment"`
}
type MessageReceived struct {
From []mail.Address `json:"from"`
To []mail.Address `json:"to"`
Subject string `json:"subject"`
Body []BodyPart `json:"body"`
Attachments []string `json:"attachments,omitempty"`
Date time.Time `json:"date"`
Error string `json:"error"`
MessageId string `json:"message_id"`
Folder string `json:"folder"`
Uid uint32 `json:"uid"`
}