Add a new header to email content before the body.
Example:
# Example for email_add_header
println email_add_header("Subject: Test\n\nBody", "From", "test@example.com")
Decode base64 encoded text.
Example:
# Example for email_base64_decode
println email_base64_decode("SGVsbG8=")
Encode text using base64 encoding.
Example:
# Example for email_base64_encode
println email_base64_encode("Hello")
Extract email addresses from text using regex pattern matching.
Example:
# Example for email_extract_addresses
println email_extract_addresses("test@example.com")
Extract attachment information from email content string.
Example:
# Example for email_get_attachments email = "From: test@example.com\nSubject: Test\nContent-Type: multipart/mixed; boundary=\"boundary\"\n\n--boundary\nContent-Type: text/plain\n\nHello\n--boundary\nContent-Type: application/octet-stream\nContent-Disposition: attachment; filename=\"test.txt\"\n\nFile content\n--boundary--" println email_get_attachments(email)
Extract email body from email content string (RFC compliant).
Example:
# Example for email_get_body
try
println email_get_body("Subject: Test\n\nBody")
catch err
println "Email parse failed"
endtry
Parse email headers from email content string (RFC compliant).
Example:
# Example for email_parse_headers email = "From: sender@example.com\nTo: recipient@example.com\nSubject: Test Email\n\nBody content" println email_parse_headers(email)
Process email template by replacing placeholders with variable values.
Example:
# Example for email_process_template
template = "Hello {name}, your order #{order} is ready."
vars = map(.name "Alice", .order "12345")
println email_process_template(template, vars)
Remove a specific header from email content.
Example:
# Example for email_remove_header email = "Subject: Test\nFrom: old@example.com\n\nBody content" println email_remove_header(email, "From")
Validate email address format.
Example:
# Example for email_validate
println email_validate("test@example.com")
println email_validate("invalid-email")
Send email via SMTP without authentication.
Example:
# Example for smtp_send
try
smtp_send("test@example.com", ["to@example.com"], "Subject", "Body")
catch err
println "SMTP failed"
endtry
Send email via SMTP with file attachments.
Example:
# Example for smtp_send_with_attachments
try
smtp_send_with_attachments("test@example.com", ["to@example.com"], "Subject", "Body", ["file.txt"])
catch err
println "SMTP failed"
endtry
Send email via SMTP with authentication.
Example:
# Example for smtp_send_with_auth
try
smtp_send_with_auth("test@example.com", ["to@example.com"], "Subject", "Body", "user", "pass")
catch err
println "SMTP failed"
endtry