53deb8e9a8
Tipos: EmailAttachment, EmailMessage, SMTPConfig. Puras: email_build_html, email_build_text, email_with_attachment, email_template_render. Impuras: smtp_connect (TLS/STARTTLS/plain), smtp_send (MIME multipart con adjuntos). Solo stdlib: net/smtp, crypto/tls, text/template, mime/multipart. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1.6 KiB
1.6 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| email_with_attachment | function | go | infra | 1.0.0 | pure | func EmailWithAttachment(msg EmailMessage, att EmailAttachment) EmailMessage | Retorna una copia del EmailMessage con el adjunto añadido al final. No muta el mensaje original. |
|
|
|
false |
|
nuevo EmailMessage con todos los campos del original mas el adjunto añadido | true |
|
functions/infra/email_build_test.go | functions/infra/email_with_attachment.go |
Ejemplo
msg := EmailBuildHTML("alice@example.com", []string{"bob@example.com"}, "Informe", "<p>Ver adjunto</p>")
att := EmailAttachment{Filename: "report.pdf", ContentType: "application/pdf", Data: pdfBytes}
msg2 := EmailWithAttachment(msg, att)
// len(msg.Attachments) == 0 (original no mutado)
// len(msg2.Attachments) == 1
Notas
Funcion pura. Implementa el patron immutable builder — cada llamada retorna un nuevo EmailMessage con copia profunda de todos los slices y mapas. Se puede encadenar varias veces para agregar multiples adjuntos.