MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / ForwardAttachments

Function ForwardAttachments

internal/outbound/forward.go:164–178  ·  view source on GitHub ↗

ForwardAttachments extracts the stored attachment parts of the message being forwarded and converts them to the outbound Attachment shape (base64-encoded data) so a forward carries the original files by default, the way mail clients do — the server already holds the bytes, so no client round-trip is

(rawMessage []byte)

Source from the content-addressed store, hash-verified

162// needed. Order matches the source message's authoritative attachment index.
163// Returns nil when the source has no attachments.
164func ForwardAttachments(rawMessage []byte) []Attachment {
165 parts := mailparse.Attachments(rawMessage)
166 if len(parts) == 0 {
167 return nil
168 }
169 out := make([]Attachment, 0, len(parts))
170 for _, p := range parts {
171 out = append(out, Attachment{
172 Filename: p.Filename,
173 ContentType: p.ContentType,
174 Data: base64.StdEncoding.EncodeToString(p.Data),
175 })
176 }
177 return out
178}
179
180// BuildForwardSubject prefixes "Fwd: " unless the subject already starts
181// with Fwd:, Fw:, or Re:. The dedup avoids stacking on chains. Empty

Calls 2

AttachmentsFunction · 0.92
makeFunction · 0.85