papercutsmtp

package module
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package papercutsmtp provides a testcontainers-go module for Papercut SMTP, a lightweight SMTP server with a built-in web UI for capturing and inspecting outbound emails in tests. No messages are relayed to real recipients.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	testcontainers.Container
}

Container represents the PapercutSMTP container type used in the module

func Run

Run creates an instance of the PapercutSMTP container type

Example
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/testcontainers/testcontainers-go"
	"github.com/testcontainers/testcontainers-go/modules/papercutsmtp"
)

func main() {
	// runPapercutSMTPContainer {
	ctx := context.Background()

	papercutsmtpContainer, err := papercutsmtp.Run(ctx, "changemakerstudiosus/papercut-smtp:latest")
	defer func() {
		if err := testcontainers.TerminateContainer(papercutsmtpContainer); err != nil {
			log.Printf("failed to terminate container: %s", err)
		}
	}()
	if err != nil {
		log.Printf("failed to start container: %s", err)
		return
	}
	// }

	state, err := papercutsmtpContainer.State(ctx)
	if err != nil {
		log.Printf("failed to get container state: %s", err)
		return
	}

	fmt.Println(state.Running)

}
Output:
true

func (*Container) HTTPURL

func (c *Container) HTTPURL(ctx context.Context) (string, error)

HTTPURL returns the URL for the Papercut SMTP web UI (port 8080).

func (*Container) SMTPEndpoint

func (c *Container) SMTPEndpoint(ctx context.Context) (string, error)

SMTPEndpoint returns the host:port endpoint for the SMTP server (port 2525).

Jump to

Keyboard shortcuts

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