inbucket

package module
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InbucketContainer

type InbucketContainer struct {
	testcontainers.Container
}

InbucketContainer represents the Inbucket container type used in the module

func Run added in v0.32.0

Run creates an instance of the Inbucket container type

Example
package main

import (
	"context"
	"fmt"
	"log"

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

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

	inbucketContainer, err := inbucket.Run(ctx, "inbucket/inbucket:sha-2d409bb")
	defer func() {
		if err := testcontainers.TerminateContainer(inbucketContainer); err != nil {
			log.Printf("failed to terminate container: %s", err)
		}
	}()
	if err != nil {
		log.Printf("failed to start container: %s", err)
		return
	}
	// }

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

	fmt.Println(state.Running)

}
Output:
true

func RunContainer deprecated

Deprecated: use Run instead RunContainer creates an instance of the Inbucket container type

func (*InbucketContainer) SmtpConnection

func (c *InbucketContainer) SmtpConnection(ctx context.Context) (string, error)

SmtpConnection returns the connection string for the smtp server, using the default 2500 port, and obtaining the host and exposed port from the container.

func (*InbucketContainer) WebInterface

func (c *InbucketContainer) WebInterface(ctx context.Context) (string, error)

WebInterface returns the connection string for the web interface server, using the default 9000 port, and obtaining the host and exposed port from the container.

Jump to

Keyboard shortcuts

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