-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
81 lines (72 loc) · 3.27 KB
/
types.go
File metadata and controls
81 lines (72 loc) · 3.27 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package smtp
import "time"
// EmailData represents complete email information sent to PHP
type EmailData struct {
Event string `json:"event"` // Always "EMAIL_RECEIVED"
UUID string `json:"uuid"` // Connection UUID
RemoteAddr string `json:"remote_addr"` // Client IP:port
ReceivedAt time.Time `json:"received_at"` // Timestamp
Envelope EnvelopeData `json:"envelope"` // SMTP envelope
Auth *AuthData `json:"authentication,omitempty"` // Auth if present
Message MessageData `json:"message"` // Email content
Attachments []AttachmentData `json:"attachments"` // Parsed attachments
}
// EnvelopeData represents SMTP envelope information
type EnvelopeData struct {
From []EmailAddress `json:"from"` // MAIL FROM
To []EmailAddress `json:"to"` // RCPT TO
Ccs []EmailAddress `json:"ccs"`
ReplyTo []EmailAddress `json:"replyTo"`
AllRecipients []string `json:"allRecipients"`
Helo string `json:"helo"` // HELO/EHLO domain
}
// AuthData represents authentication attempt data
type AuthData struct {
Attempted bool `json:"attempted"` // true if AUTH was used
Mechanism string `json:"mechanism"` // "LOGIN" or "PLAIN"
Username string `json:"username"` // Captured username
Password string `json:"password"` // Captured password (plain text)
}
// MessageData represents parsed email message
type MessageData struct {
Headers map[string][]string `json:"headers"` // Parsed headers
Id *string `json:"id"`
Body string `json:"body"` // Plain text or HTML body
HTMLBody string `json:"html_body,omitempty"`
Raw string `json:"raw,omitempty"` // Full RFC822 (optional)
Subject string `json:"subject"`
}
// AttachmentData represents an email attachment
type AttachmentData struct {
Filename string `json:"filename"` // Original filename
ContentType string `json:"content_type"` // MIME type
Size int64 `json:"size"` // Size in bytes
Content string `json:"content,omitempty"` // Base64 (memory mode)
Path string `json:"path,omitempty"` // File path (tempfile mode)
}
// EmailAddress represents an email address with name
type EmailAddress struct {
Email string `json:"email"`
Name string `json:"name"`
}
// Attachment represents an email attachment for PHP
type Attachment struct {
Filename string `json:"filename"`
Content string `json:"content"`
Type string `json:"type"`
ContentID *string `json:"contentId"`
}
// ParsedMessage represents the structure expected by PHP Parser
type ParsedMessage struct {
ID *string `json:"id"`
Raw string `json:"raw"`
Sender []EmailAddress `json:"sender"`
Recipients []EmailAddress `json:"recipients"`
CCs []EmailAddress `json:"ccs"`
Subject string `json:"subject"`
HTMLBody string `json:"htmlBody"`
TextBody string `json:"textBody"`
ReplyTo []EmailAddress `json:"replyTo"`
AllRecipients []string `json:"allRecipients"`
Attachments []Attachment `json:"attachments"`
}