mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +00:00
Add a script to generate a few test emails
This commit is contained in:
BIN
swaks-tests/favicon.png
Normal file
BIN
swaks-tests/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.0 KiB |
25
swaks-tests/html.raw
Normal file
25
swaks-tests/html.raw
Normal file
@@ -0,0 +1,25 @@
|
||||
Date: %DATE%
|
||||
To: %TO_ADDRESS%
|
||||
From: %FROM_ADDRESS%
|
||||
Subject: Swaks HTML
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/alternative; boundary="----=_MIME_BOUNDARY_000_62717"
|
||||
|
||||
------=_MIME_BOUNDARY_000_62717
|
||||
Content-Type: text/plain
|
||||
|
||||
This is a test mailing.
|
||||
|
||||
This should be clickable: http://google.com/
|
||||
|
||||
------=_MIME_BOUNDARY_000_62717
|
||||
Content-Type: text/html
|
||||
Content-Transfer-Encoding: BASE64
|
||||
|
||||
PGh0bWw+Cjxib2R5Pgo8cD5UaGlzIGlzIGEgdGVzdCBtYWlsaW5nIDxiPmluIEhUTUw8L2I+PC9w
|
||||
PgoKPHA+VGhpcyBzaG91bGQgYmUgY2xpY2thYmxlOiA8YSBocmVmPSJodHRwOi8vZ29vZ2xlLmNv
|
||||
bS8iPmdvb2dsZS5jb208L2E+PC9wPgo8L2JvZHk+CjwvaHRtbD4K
|
||||
|
||||
------=_MIME_BOUNDARY_000_62717--
|
||||
|
||||
|
||||
13
swaks-tests/run-tests.sh
Executable file
13
swaks-tests/run-tests.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
export SWAKS_OPT_server="127.0.0.1:2500"
|
||||
export SWAKS_OPT_to="swaks@inbucket.local"
|
||||
|
||||
# Basic test
|
||||
swaks --h-Subject: "Swaks Plain Text" --body text.txt
|
||||
|
||||
# HTML test
|
||||
swaks --h-Subject: "Swaks HTML" --data html.raw
|
||||
|
||||
# Attachment test
|
||||
swaks --h-Subject: "Swaks Attachment" --attach-type image/png --attach favicon.png
|
||||
3
swaks-tests/text.txt
Normal file
3
swaks-tests/text.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
This is a test mailing.
|
||||
|
||||
This should be clickable: http://google.com/
|
||||
@@ -63,15 +63,15 @@ func MailboxShow(w http.ResponseWriter, req *http.Request, ctx *Context) (err er
|
||||
|
||||
mb, err := ctx.DataStore.MailboxFor(name)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("MailboxFor('%v'): %v", name, err)
|
||||
}
|
||||
message, err := mb.GetMessage(id)
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("GetMessage() failed: %v", err)
|
||||
}
|
||||
_, mime, err := message.ReadBody()
|
||||
if err != nil {
|
||||
return err
|
||||
return fmt.Errorf("ReadBody() failed: %v", err)
|
||||
}
|
||||
body := template.HTML(textToHtml(mime.Text))
|
||||
htmlAvailable := mime.Html != ""
|
||||
|
||||
Reference in New Issue
Block a user