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 ¶
func Run(ctx context.Context, img string, opts ...testcontainers.ContainerCustomizer) (*Container, error)
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
Click to show internal directories.
Click to hide internal directories.