Files
fn_registry/functions/infra/email_build_text.md
T
egutierrez 53deb8e9a8 feat: tipos y funciones email SMTP en Go (infra)
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>
2026-04-13 02:01:13 +02:00

51 lines
1.4 KiB
Markdown

---
name: email_build_text
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: pure
signature: "func EmailBuildText(from string, to []string, subject, bodyText string) EmailMessage"
description: "Construye un EmailMessage con cuerpo de texto plano. Retorna una nueva estructura sin CC, BCC, adjuntos ni headers custom."
tags: [email, smtp, text, builder]
uses_functions: []
uses_types: [EmailMessage_go_infra]
returns: [EmailMessage_go_infra]
returns_optional: false
error_type: ""
imports: []
params:
- name: from
desc: "direccion del remitente (ej: 'Alice <alice@example.com>')"
- name: to
desc: "lista de direcciones de destinatarios principales"
- name: subject
desc: "asunto del correo"
- name: bodyText
desc: "contenido de texto plano del cuerpo del mensaje"
output: "EmailMessage listo para enviar con cuerpo de texto plano"
tested: true
tests:
- "construye mensaje text con campos basicos"
- "body html queda vacio"
test_file_path: "functions/infra/email_build_test.go"
file_path: "functions/infra/email_build_text.go"
---
## Ejemplo
```go
msg := EmailBuildText(
"alice@example.com",
[]string{"bob@example.com"},
"Alerta critica",
"El servidor cayó a las 03:42 UTC.",
)
// msg.BodyText = "El servidor cayó a las 03:42 UTC."
// msg.BodyHTML = ""
```
## Notas
Funcion pura. Analogo de `EmailBuildHTML` para texto plano. Para anadir adjuntos usar `EmailWithAttachment`.