title: “MAIL::MAIL” author: “laplante@plcb.ca” date: 2024-03-12 version: “1.0.2” section: “1g”
mail::mail — Send an email
mail::mail(from: string, to: string [, format: “goweb”, charset: string, ct: string, encoding: string, port: int, host: string, username: string, password: string, cc: string, bcc: string, message: string, subject: string, error: variable, content: array])
The mail::mail
function is used to send emails.
It supports plain text, HTML, attachments, and multipart content.
text/plain
). If set to "guess"
, the system attempts to determine the type automatically."base64"
. Other values are ignored."goweb"
, the message body is processed by goweb before being sent. Default is "goweb"
.content: [
{ charset: string, encoding: string, format: text|goweb, file: string|inline: string, ct: string },
...
]
This allows sending inline content, attachments, or multipart alternatives (e.g., plain text + HTML).
mail(
from: "goweb@plcb.ca",
host: "eris",
password: "...",
port: 587,
to: "laplante@plcb.ca",
subject: "Test with content Example été",
ct: "text/html",
cc: "laplante.p@gmail.com",
encoding: "base64",
message: "<div dir=\"ltr\"><b>TEST MAC éèçÉÈÇâ {{ datetime() }}</b></div>",
format: "goweb",
content: [
{ "message": "Content part inline1" },
{ "format": "goweb", "message": "Content part inline2 {{ datetime(); }}" },
{ "ct": "guess", "file": "moi.png" },
[
{ "ct": "text/plain", "message": "Content multipart inline3" },
{ "ct": "text/html", "message": "<h1>Content multipart inline3</h1>" }
]
]
);
laplante@plcb.ca