AtlatestRepositorysigil-ses
1
;;; Integration test — sends a real email via SES2
;;; Requires: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION env vars3
;;; Run: SIGIL_REDIRECTS=dev-redirects.sgl sigil eval -f examples/integration-test.sgl5
(import (sigil core)6
(only (sigil process) getenv)7
(amazon ses))9
(define client10
(ses-client access-key-id: (getenv "AWS_ACCESS_KEY_ID")11
secret-access-key: (getenv "AWS_SECRET_ACCESS_KEY")12
region: (or (getenv "AWS_REGION") "us-east-2")))14
;; Test 1: Get account info15
(display "=== Account Info ===\n")16
(let ((acct (ses-get-account client)))17
(display "Send quota: ") (display (ses-account-send-quota acct)) (newline)18
(display "Send rate: ") (display (ses-account-send-rate acct)) (newline)19
(display "Sent last 24h: ") (display (ses-account-sent-last-24h acct)) (newline)20
(display "Status: ") (display (ses-account-enforcement-status acct)) (newline))22
;; Test 2: Check identity23
(display "\n=== Identity Check ===\n")24
(let ((id (ses-get-identity client "systemcrafters.net")))25
(display "Domain: ") (display (ses-identity-name id)) (newline)26
(display "Verified: ") (display (ses-identity-verified? id)) (newline)27
(display "DKIM: ") (display (ses-identity-dkim-status id)) (newline)28
(display "MAIL FROM: ") (display (ses-identity-mail-from-status id)) (newline))30
;; Test 3: Send a test email31
(display "\n=== Sending Test Email ===\n")32
(let ((result (ses-send-email client35
"sigil-ses integration test"36
"This email was sent by the sigil-ses library integration test."37
html: "<h2>sigil-ses Integration Test</h2><p>This email was sent by the <code>sigil-ses</code> library.</p>")))38
(display "Message ID: ") (display (ses-email-result-message-id result)) (newline))40
(display "\nDone!\n")