apiv1

package
v1.20.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 17, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package apiv1 handles all the API responses

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppInfo

func AppInfo(w http.ResponseWriter, _ *http.Request)

AppInfo returns some basic details about the running app, and latest release.

func DeleteMessages

func DeleteMessages(w http.ResponseWriter, r *http.Request)

DeleteMessages (method: DELETE) deletes all messages matching IDS.

func DeleteSearch added in v1.9.0

func DeleteSearch(w http.ResponseWriter, r *http.Request)

DeleteSearch will delete all messages matching a search

func DeleteTag added in v1.19.0

func DeleteTag(w http.ResponseWriter, r *http.Request)

DeleteTag (method: DELETE) used to delete a tag

func DownloadAttachment

func DownloadAttachment(w http.ResponseWriter, r *http.Request)

DownloadAttachment (method: GET) returns the attachment data

func DownloadRaw

func DownloadRaw(w http.ResponseWriter, r *http.Request)

DownloadRaw (method: GET) returns the full email source as plain text

func GetAllTags added in v1.12.0

func GetAllTags(w http.ResponseWriter, _ *http.Request)

GetAllTags (method: GET) will get all tags currently in use

func GetHeaders added in v1.5.0

func GetHeaders(w http.ResponseWriter, r *http.Request)

GetHeaders (method: GET) returns the message headers as JSON

func GetMessage

func GetMessage(w http.ResponseWriter, r *http.Request)

GetMessage (method: GET) returns the Message as JSON

func GetMessages

func GetMessages(w http.ResponseWriter, r *http.Request)

GetMessages returns a paginated list of messages as JSON

func GetOptions added in v1.6.9

func GetOptions(w http.ResponseWriter, _ *http.Request)

GetOptions returns a blank response

func HTMLCheck added in v1.8.0

func HTMLCheck(w http.ResponseWriter, r *http.Request)

HTMLCheck returns a summary of the HTML client support

func LinkCheck added in v1.8.2

func LinkCheck(w http.ResponseWriter, r *http.Request)

LinkCheck returns a summary of links in the email

func ReleaseMessage added in v1.6.0

func ReleaseMessage(w http.ResponseWriter, r *http.Request)

ReleaseMessage (method: POST) will release a message via a pre-configured external SMTP server.

func RenameTag added in v1.19.0

func RenameTag(w http.ResponseWriter, r *http.Request)

RenameTag (method: PUT) used to rename a tag

func Search(w http.ResponseWriter, r *http.Request)

Search returns the latest messages as JSON

func SendMessageHandler added in v1.18.0

func SendMessageHandler(w http.ResponseWriter, r *http.Request)

SendMessageHandler handles HTTP requests to send a new message

func SetMessageTags added in v1.12.0

func SetMessageTags(w http.ResponseWriter, r *http.Request)

SetMessageTags (method: PUT) will set the tags for all provided IDs

func SetReadStatus

func SetReadStatus(w http.ResponseWriter, r *http.Request)

SetReadStatus (method: PUT) will update the status to Read/Unread for all provided IDs If no IDs are provided then all messages are updated.

func SpamAssassinCheck added in v1.13.0

func SpamAssassinCheck(w http.ResponseWriter, r *http.Request)

SpamAssassinCheck returns a summary of SpamAssassin results (if enabled)

func Thumbnail

func Thumbnail(w http.ResponseWriter, r *http.Request)

Thumbnail returns a thumbnail image for an attachment (images only)

func WebUIConfig added in v1.6.0

func WebUIConfig(w http.ResponseWriter, _ *http.Request)

WebUIConfig returns configuration settings for the web UI.

Types

type Attachment

type Attachment = storage.Attachment

Attachment summary

type HTMLCheckResponse added in v1.8.0

type HTMLCheckResponse = htmlcheck.Response

HTMLCheckResponse summary

type JSONErrorMessage added in v1.18.0

type JSONErrorMessage struct {
	// Error message
	// example: invalid format
	Error string
}

JSONErrorMessage struct

type LinkCheckResponse added in v1.8.2

type LinkCheckResponse = linkcheck.Response

LinkCheckResponse summary

type Message

type Message = storage.Message

Message data

type MessageSummary

type MessageSummary = storage.MessageSummary

MessageSummary - summary of a single message

type MessagesSummary

type MessagesSummary struct {
	// Total number of messages in mailbox
	Total float64 `json:"total"`

	// Total number of unread messages in mailbox
	Unread float64 `json:"unread"`

	// Legacy - now undocumented in API specs but left for backwards compatibility.
	// Removed from API documentation 2023-07-12
	// swagger:ignore
	Count float64 `json:"count"`

	// Total number of messages matching current query
	MessagesCount float64 `json:"messages_count"`

	// Pagination offset
	Start int `json:"start"`

	// All current tags
	Tags []string `json:"tags"`

	// Messages summary
	// in: body
	Messages []storage.MessageSummary `json:"messages"`
}

MessagesSummary is a summary of a list of messages

type SendMessageConfirmation added in v1.18.0

type SendMessageConfirmation struct {
	// Database ID
	// example: iAfZVVe2UQFNSG5BAjgYwa
	ID string
}

SendMessageConfirmation struct

type SendRequest added in v1.18.0

type SendRequest struct {
	// "From" recipient
	// required: true
	From struct {
		// Optional name
		// example: John Doe
		Name string
		// Email address
		// example: john@example.com
		// required: true
		Email string
	}

	// "To" recipients
	To []struct {
		// Optional name
		// example: Jane Doe
		Name string
		// Email address
		// example: jane@example.com
		// required: true
		Email string
	}

	// Cc recipients
	Cc []struct {
		// Optional name
		// example: Manager
		Name string
		// Email address
		// example: manager@example.com
		// required: true
		Email string
	}

	// Bcc recipients email addresses only
	// example: ["jack@example.com"]
	Bcc []string

	// Optional Reply-To recipients
	ReplyTo []struct {
		// Optional name
		// example: Secretary
		Name string
		// Email address
		// example: secretary@example.com
		// required: true
		Email string
	}

	// Subject
	// example: Mailpit message via the HTTP API
	Subject string

	// Message body (text)
	// example: This is the text body
	Text string

	// Message body (HTML)
	// example: <p style="font-family: arial">Mailpit is <b>awesome</b>!</p>
	HTML string

	// Attachments
	Attachments []struct {
		// Base64-encoded string of the file content
		// required: true
		// example: VGhpcyBpcyBhIHBsYWluIHRleHQgYXR0YWNobWVudA==
		Content string
		// Filename
		// required: true
		// example: AttachedFile.txt
		Filename string
	}

	// Mailpit tags
	// example: ["Tag 1","Tag 2"]
	Tags []string

	// Optional headers in {"key":"value"} format
	// example: {"X-IP":"1.2.3.4"}
	Headers map[string]string
}

SendRequest to send a message via HTTP swagger:model SendRequest

func (SendRequest) Send added in v1.18.0

func (d SendRequest) Send(remoteAddr string) (string, error)

Send will validate the message structure and attempt to send to Mailpit. It returns a sending summary or an error.

type SpamAssassinResponse added in v1.13.0

type SpamAssassinResponse = spamassassin.Result

SpamAssassinResponse summary

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL