Skip to content

About

Temporary test email account creator for Ethereal Email and Nodemailer in automated tests

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ethereal-go

Go Reference License: MIT

Go client for creating temporary test email accounts on Ethereal Email using Nodemailer's provisioning API. Useful for automated tests and CI without needing real mail accounts.

Features

  • Creates test SMTP, IMAP, and POP3 credentials in a single HTTP request
  • Standard library integration with helpers for smtp.PlainAuth and "host:port" formatting
  • Host and address checkers to detect Ethereal email domains
  • Web preview URL generator for message IDs
  • Standard library only, no third-party dependencies

Installation

go get github.com/fumbledlol/ethereal-go

Usage

Sending a test email

package main

import (
	"context"
	"fmt"
	"net/smtp"

	"github.com/fumbledlol/ethereal-go"
)

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

	// Provision new credentials
	acc, err := ethereal.CreateAccount(ctx)
	if err != nil {
		panic(err)
	}

	fmt.Printf("User: %s\n", acc.User)
	fmt.Printf("Web inbox: %s\n", acc.Web)

	// Send an email with net/smtp
	msg := []byte("To: recipient@example.com\r\nSubject: Test Email\r\n\r\nHello from Ethereal.")
	err = smtp.SendMail(
		acc.SMTPAddr(),
		acc.Auth(),
		acc.User,
		[]string{"recipient@example.com"},
		msg,
	)
	if err != nil {
		panic(err)
	}

	fmt.Println("Message sent. Check web inbox link above.")
}

Host and address helpers

ethereal.IsEtherealHost("smtp.ethereal.email")     // true
ethereal.IsEtherealAddress("steve@ethereal.email") // true

Benchmarks

BenchmarkIsEtherealAddress-12   75256341    17.71 ns/op    0 B/op    0 allocs/op
BenchmarkIsEtherealHost-12      55537813    20.12 ns/op    0 B/op    0 allocs/op

License

MIT

About

Temporary test email account creator for Ethereal Email and Nodemailer in automated tests

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages