./example/mailer/e2e.shlet message = @mail.build_encrypted_mail(
from, to, // MailAddress(display_name, addr)
subject=..., text=..., // 头值必须 ASCII(fail-fast)
attachments=..., // base64 CTE
signer=private_key, // 先签:multipart/signed(micalg=pgp-sha256)
recipients=[public_key], // 后密:multipart/encrypted
domain="mailpgp.example", // Message-ID / EHLO
now_unix?, tz_offset_minutes?, // 缺省取平台时钟/时区(native)
)# 文件模式(推荐给真实邮箱:TLS/重试/队列交给 MTA)
moon run example/mailer -- --from "A <a@x>" --to "B <b@y>" ... --mode file --out mail.eml
msmtp --read-envelope-from < mail.eml
# SMTP 模式(仅限本地/可信中继;无 TLS 是既定边界)
moon run example/mailer -- --from ... --to ... --body-file ... --sender-key ... \
--recipient-cert ... --domain ... --mode smtp \
--smtp-host 127.0.0.1 --smtp-port 2525 \
[--smtp-user u --smtp-pass-env SMTP_PASS]Install
Download zipPure-MoonBit OpenPGP implementation (RFC 4880/9580): email encryption, decryption, signing and verification, interoperable with GnuPG and gopenpgp.