Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/config-examples/ews-basic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EWS — Basic authentication (legacy; requires basic auth enabled on Exchange)
# Usage: gomailtest ews testconnect|testauth|getfolder --config ews-basic.yaml
host: mail.example.com
port: 443
username: user@example.com
password: change-me
authmethod: Basic
# ewspath: /EWS/Exchange.asmx # default; override for non-standard installations
# mailbox: targetuser@example.com # set for mailbox impersonation
# skipverify: true # skip TLS certificate verification (testing only)
# tlsversion: "1.3" # minimum TLS version; default is 1.2
# proxy: http://proxy.example.com:8080
12 changes: 12 additions & 0 deletions docs/config-examples/ews-bearer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EWS — OAuth2 Bearer token auth with mailbox impersonation
# Usage: gomailtest ews testauth|getfolder --config ews-bearer.yaml
host: mail.example.com
port: 443
username: serviceaccount@example.com
accesstoken: eyJ0eXAiOiJKV1Qi...your-oauth2-token-here
authmethod: Bearer
# mailbox is required when using a service account to access another user's mailbox
mailbox: targetuser@example.com
# ewspath: /EWS/Exchange.asmx # default; override for non-standard installations
# skipverify: true # skip TLS certificate verification (testing only)
# proxy: http://proxy.example.com:8080
14 changes: 14 additions & 0 deletions docs/config-examples/ews-ntlm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EWS — NTLM auth for on-premises Exchange with Active Directory
# Usage: gomailtest ews testconnect|testauth|getfolder|autodiscover --config ews-ntlm.yaml
host: mail.contoso.com
port: 443
username: CONTOSO\user
password: change-me
authmethod: NTLM
# domain: CONTOSO # alternative to embedding domain in username (DOMAIN\user form)
# ewspath: /EWS/Exchange.asmx # default; override for non-standard installations
# autodiscoverpath: /autodiscover/autodiscover.svc # used by the autodiscover action
# mailbox: targetuser@contoso.com # set for mailbox impersonation (service account scenario)
# skipverify: true # skip TLS certificate verification (testing only)
# tlsversion: "1.3" # minimum TLS version; default is 1.2
# proxy: http://proxy.example.com:8080
16 changes: 16 additions & 0 deletions docs/config-examples/imap-exportmessages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# IMAP — export matching messages as .eml files
# Usage: gomailtest imap exportmessages --config imap-exportmessages.yaml
host: imap.example.com
port: 993
imaps: true
username: user@example.com
password: change-me
# Search filters — at least one of subject or messageid is typically provided
subject: "Invoice"
# messageid: "<unique-id@example.com>"
mailbox: INBOX
count: 25
exportdir: C:\exports
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000
19 changes: 19 additions & 0 deletions docs/config-examples/imap-imaps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# IMAP — implicit TLS / IMAPS (port 993): Gmail, Microsoft 365, Yahoo, iCloud
# Usage: gomailtest imap testconnect|testauth|listfolders --config imap-imaps.yaml
host: imap.example.com
port: 993
imaps: true
username: user@example.com
password: change-me
# authmethod: auto # auto-selects: PLAIN or LOGIN
# skipverify: true # skip TLS certificate verification (testing only)
# tlsversion: "1.3" # minimum TLS version; default is 1.2
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000

# Provider quick-reference:
# Gmail: host: imap.gmail.com port: 993
# Microsoft 365: host: outlook.office365.com port: 993
# Yahoo: host: imap.mail.yahoo.com port: 993
# iCloud: host: imap.mail.me.com port: 993
10 changes: 10 additions & 0 deletions docs/config-examples/imap-oauth2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# IMAP — XOAUTH2 token auth (Microsoft 365 / Google Workspace)
# Usage: gomailtest imap testauth|listfolders --config imap-oauth2.yaml
host: imap.gmail.com
port: 993
imaps: true
username: user@example.com
accesstoken: ya29.your-oauth2-token-here
authmethod: XOAUTH2
# skipverify: true # skip TLS certificate verification (testing only)
# proxy: http://proxy.example.com:8080
13 changes: 13 additions & 0 deletions docs/config-examples/imap-starttls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# IMAP — explicit TLS via STARTTLS (port 143)
# Usage: gomailtest imap testconnect|testauth|listfolders --config imap-starttls.yaml
host: imap.example.com
port: 143
starttls: true
username: user@example.com
password: change-me
# authmethod: auto # auto-selects: PLAIN or LOGIN
# skipverify: true # skip TLS certificate verification (testing only)
# tlsversion: "1.3" # minimum TLS version; default is 1.2
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000
9 changes: 9 additions & 0 deletions docs/config-examples/jmap-basic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# JMAP — Basic (password) auth for self-hosted JMAP servers (Cyrus IMAP, Apache James)
# Usage: gomailtest jmap testconnect|testauth|getmailboxes --config jmap-basic.yaml
host: jmap.example.com
port: 443
username: user@example.com
password: change-me
authmethod: basic
# skipverify: true # skip TLS certificate verification — useful for self-signed certs
# address: 192.168.1.10 # connect to this IP instead of --host (host still used for TLS SNI)
11 changes: 11 additions & 0 deletions docs/config-examples/jmap-bearer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# JMAP — Bearer token auth (Fastmail and similar providers)
# Usage: gomailtest jmap testconnect|testauth|getmailboxes --config jmap-bearer.yaml
host: jmap.fastmail.com
port: 443
username: user@fastmail.com
accesstoken: fmu1-xxxxxxxx-your-api-token-here
authmethod: bearer
# skipverify: true # skip TLS certificate verification (testing only)

# Getting a Fastmail API token:
# Settings → Password & Security → API Tokens → New Token
8 changes: 8 additions & 0 deletions docs/config-examples/msgraph-bearer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Microsoft Graph — pre-obtained Bearer token auth
# Usage: gomailtest msgraph testconnect|testauth|getevents|getinbox --config msgraph-bearer.yaml
# Useful when a token has already been obtained outside gomailtest (e.g. via az cli or custom OAuth flow).
tenantid: 00000000-0000-0000-0000-000000000000
clientid: 00000000-0000-0000-0000-000000000000
bearertoken: eyJ0eXAiOiJKV1Qi...your-bearer-token-here
mailbox: user@example.com
# proxy: http://proxy.example.com:8080
10 changes: 10 additions & 0 deletions docs/config-examples/msgraph-pfx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Microsoft Graph — PFX certificate file auth
# Usage: gomailtest msgraph testconnect|testauth|getevents|getinbox --config msgraph-pfx.yaml
tenantid: 00000000-0000-0000-0000-000000000000
clientid: 00000000-0000-0000-0000-000000000000
pfx: C:\Certs\app-cert.pfx
pfxpass: certificate-password
mailbox: user@example.com
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000
10 changes: 10 additions & 0 deletions docs/config-examples/msgraph-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Microsoft Graph — client secret auth (most common app registration scenario)
# Usage: gomailtest msgraph testconnect|testauth|getevents|getinbox|getschedule --config msgraph-secret.yaml
tenantid: 00000000-0000-0000-0000-000000000000
clientid: 00000000-0000-0000-0000-000000000000
secret: your-client-secret-here
mailbox: user@example.com
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000
# count: 3 # number of items for getevents / getinbox (default 3)
22 changes: 22 additions & 0 deletions docs/config-examples/msgraph-sendmail.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Microsoft Graph — full sendmail scenario: HTML body, CC/BCC, attachments, inline images, headers
# Usage: gomailtest msgraph sendmail --config msgraph-sendmail.yaml
tenantid: 00000000-0000-0000-0000-000000000000
clientid: 00000000-0000-0000-0000-000000000000
secret: your-client-secret-here
mailbox: sender@example.com
to: recipient@example.com
# cc: cc@example.com
# bcc: bcc@example.com
subject: "Test Email from gomailtest"
body: "Plain-text fallback for clients that do not render HTML."
bodyHTML: "<p>Hello! This is a <strong>test</strong> message from gomailtest.</p>"
# attachments: C:\Reports\report.pdf,C:\Reports\data.csv
# inline-attachments: C:\Branding\logo.png # embedded inline; reference as cid:logo.png in bodyHTML
# body-template: C:\Templates\email.html # path to HTML template file (alternative to bodyHTML)
# Graph only passes through X- prefixed custom headers; standard RFC headers are controlled by the API
header:
- "X-Custom-Header: example-value"
# priority: high # high | normal (default) | low
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000
10 changes: 10 additions & 0 deletions docs/config-examples/msgraph-thumbprint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Microsoft Graph — Windows certificate store auth via thumbprint (Windows only)
# Usage: gomailtest msgraph testconnect|testauth|getevents|getinbox --config msgraph-thumbprint.yaml
# Certificate must be present in the CurrentUser\My store on the machine running gomailtest.
tenantid: 00000000-0000-0000-0000-000000000000
clientid: 00000000-0000-0000-0000-000000000000
thumbprint: CD817B3329802E692CF30D8DDF896FE811B048AB
mailbox: user@example.com
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000
15 changes: 15 additions & 0 deletions docs/config-examples/pop3-exportmessages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# POP3 — export matching messages as .eml files
# Usage: gomailtest pop3 exportmessages --config pop3-exportmessages.yaml
host: pop.example.com
port: 995
pop3s: true
username: user@example.com
password: change-me
# Search filters — at least one of subject or messageid is typically provided
subject: "Invoice"
# messageid: "<unique-id@example.com>"
count: 25
exportdir: C:\exports
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000
19 changes: 19 additions & 0 deletions docs/config-examples/pop3-pop3s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# POP3 — implicit TLS / POP3S (port 995)
# Usage: gomailtest pop3 testconnect|testauth|listmail --config pop3-pop3s.yaml
host: pop.example.com
port: 995
pop3s: true
username: user@example.com
password: change-me
# authmethod: auto # auto-selects: USER/PASS or APOP
# maxmessages: 100 # limit for listmail (default 100)
# skipverify: true # skip TLS certificate verification (testing only)
# tlsversion: "1.3" # minimum TLS version; default is 1.2
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000

# Provider quick-reference:
# Gmail: host: pop.gmail.com port: 995
# M365: host: outlook.office365.com port: 995
# Yahoo: host: pop.mail.yahoo.com port: 995
14 changes: 14 additions & 0 deletions docs/config-examples/pop3-starttls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# POP3 — explicit TLS via STLS (port 110)
# Usage: gomailtest pop3 testconnect|testauth|listmail --config pop3-starttls.yaml
host: pop.example.com
port: 110
starttls: true
username: user@example.com
password: change-me
# authmethod: auto # auto-selects: USER/PASS or APOP
# maxmessages: 100 # limit for listmail (default 100)
# skipverify: true # skip TLS certificate verification (testing only)
# tlsversion: "1.3" # minimum TLS version; default is 1.2
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000
26 changes: 26 additions & 0 deletions docs/config-examples/serve.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Serve mode — HTTP REST server with SMTP and Microsoft Graph backends
# Usage: gomailtest serve --config serve.yaml
port: 8080
listen: 127.0.0.1
api-key: change-me

# SMTP backend — seeds the /smtp/sendmail endpoint
# Environment variables (SMTP*) take precedence over values here.
smtp:
host: smtp.example.com
port: 587
starttls: true
username: user@example.com
password: change-me
from: sender@example.com
# skipverify: true
# proxy: http://proxy.example.com:8080

# Microsoft Graph backend — seeds the /msgraph/sendmail endpoint
# Environment variables (MSGRAPH*) take precedence over values here.
msgraph:
tenantid: 00000000-0000-0000-0000-000000000000
clientid: 00000000-0000-0000-0000-000000000000
secret: your-client-secret-here
mailbox: sender@example.com
# proxy: http://proxy.example.com:8080
11 changes: 11 additions & 0 deletions docs/config-examples/smtp-gssapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SMTP — GSSAPI/Kerberos auth for on-premises Active Directory (port 25)
# Usage: gomailtest smtp testconnect|testauth --config smtp-gssapi.yaml
host: mail.contoso.com
port: 25
# username must be in user@REALM format; realm is auto-extracted
username: alice@CONTOSO.COM
password: change-me
authmethod: GSSAPI
# realm: CONTOSO.COM # optional — auto-extracted from username if omitted
# kdc: dc01.contoso.com # optional — uses DNS SRV records if omitted; set when SRV records are missing
# proxy: http://proxy.example.com:8080
11 changes: 11 additions & 0 deletions docs/config-examples/smtp-ntlm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SMTP — NTLM auth for on-premises Exchange / Windows SMTP relay (port 25)
# Usage: gomailtest smtp testconnect|testauth --config smtp-ntlm.yaml
host: mail.contoso.com
port: 25
# username in DOMAIN\user format; plain user@domain.com is also accepted
username: CONTOSO\user
password: change-me
authmethod: NTLM
# no-starttls: true # force plain connection when the server advertises STARTTLS but you want to skip it
# skipverify: true # skip TLS certificate verification (testing only)
# proxy: http://proxy.example.com:8080
11 changes: 11 additions & 0 deletions docs/config-examples/smtp-oauth2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SMTP — OAuth2 token auth (XOAUTH2 for M365/Google, OAUTHBEARER for RFC 7628 servers)
# Usage: gomailtest smtp testauth --config smtp-oauth2.yaml
host: smtp.office365.com
port: 587
starttls: true
username: user@example.com
accesstoken: eyJ0eXAiOiJKV1Qi...your-oauth2-token-here
# authmethod: XOAUTH2 # for Microsoft 365 and Google Workspace
# authmethod: OAUTHBEARER # for Dovecot and other RFC 7628-compliant servers
authmethod: XOAUTH2
# proxy: http://proxy.example.com:8080
23 changes: 23 additions & 0 deletions docs/config-examples/smtp-sendmail.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SMTP — full sendmail scenario: HTML body, CC/BCC, attachments, inline images, headers
# Usage: gomailtest smtp sendmail --config smtp-sendmail.yaml
host: smtp.example.com
port: 587
starttls: true
username: user@example.com
password: change-me
from: sender@example.com
to: recipient@example.com
# cc: cc@example.com # visible in Cc: header and SMTP envelope
# bcc: bcc@example.com # SMTP envelope only — never written to message headers
subject: "Test Email from gomailtest"
body: "Plain-text fallback for clients that do not render HTML."
bodyhtml: "<p>Hello! This is a <strong>test</strong> message from gomailtest.</p>"
# attachments: ./report.pdf,./data.csv # comma-separated regular attachments
# inline-attachments: ./logo.png # embedded inline; reference as cid:logo.png in bodyhtml
header:
- "X-Custom-Header: example-value"
# priority: high # high | normal (default) | low — adds X-Priority/Importance/Priority headers
# use-mx: true # resolve --to recipient domain MX and connect there directly
# proxy: http://proxy.example.com:8080
# maxretries: 3
# retrydelay: 2000
11 changes: 11 additions & 0 deletions docs/config-examples/smtp-smtps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SMTP — password auth with implicit TLS / SMTPS (port 465)
# Usage: gomailtest smtp testconnect|teststarttls|testauth --config smtp-smtps.yaml
host: smtp.example.com
port: 465
smtps: true
username: user@example.com
password: change-me
# authmethod: auto # auto-selects strongest advertised method
# skipverify: true # skip TLS certificate verification (testing only)
# tlsversion: "1.3" # minimum TLS version; default is 1.2
# proxy: http://proxy.example.com:8080
11 changes: 11 additions & 0 deletions docs/config-examples/smtp-starttls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SMTP — password auth over STARTTLS (port 587)
# Usage: gomailtest smtp testconnect|teststarttls|testauth --config smtp-starttls.yaml
host: smtp.example.com
port: 587
starttls: true
username: user@example.com
password: change-me
# authmethod: auto # auto-selects strongest advertised method (CRAM-MD5 > NTLM > PLAIN > LOGIN)
# skipverify: true # skip TLS certificate verification (testing only)
# tlsversion: "1.3" # minimum TLS version; default is 1.2
# proxy: http://proxy.example.com:8080
22 changes: 22 additions & 0 deletions docs/env-examples/ews-basic.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# EWS — Basic authentication (legacy; requires basic auth enabled on Exchange)
# Usage: set these variables, then run:
# gomailtest ews testconnect|testauth|getfolder

# ── Connection ───────────────────────────────────────────────────────────────
EWSHOST=mail.example.com
EWSPORT=443
# EWSTIMEOUT=30
# EWSPATH=/EWS/Exchange.asmx
# EWSPROXY=http://proxy.example.com:8080

# ── TLS ──────────────────────────────────────────────────────────────────────
# EWSSKIPVERIFY=false
# EWSTLSVERSION=1.2

# ── Authentication ───────────────────────────────────────────────────────────
EWSUSERNAME=user@example.com
EWSPASSWORD=change-me
EWSAUTHMETHOD=Basic

# ── Impersonation ────────────────────────────────────────────────────────────
# EWSMAILBOX=targetuser@example.com
22 changes: 22 additions & 0 deletions docs/env-examples/ews-bearer.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# EWS — OAuth2 Bearer token auth with mailbox impersonation
# Usage: set these variables, then run:
# gomailtest ews testauth|getfolder

# ── Connection ───────────────────────────────────────────────────────────────
EWSHOST=mail.example.com
EWSPORT=443
# EWSTIMEOUT=30
# EWSPATH=/EWS/Exchange.asmx
# EWSPROXY=http://proxy.example.com:8080

# ── TLS ──────────────────────────────────────────────────────────────────────
# EWSSKIPVERIFY=false

# ── Authentication ───────────────────────────────────────────────────────────
EWSUSERNAME=serviceaccount@example.com
EWSACCESSTOKEN=eyJ0eXAiOiJKV1Qi...your-oauth2-token-here
EWSAUTHMETHOD=Bearer

# ── Impersonation ────────────────────────────────────────────────────────────
# Required when a service account accesses another user's mailbox
EWSMAILBOX=targetuser@example.com
Loading
Loading