func DefaultSMTPPolicySet() ServerPolicySet {
	return ServerPolicySet{
		RequireAuthentication:   false,
		RequireLocalDelivery:    true,
		MaximumRecipients:       500,
		RequireTLS:              false,
		DisableTLS:              false,
		MaximumLineLength:       1024000,
		MaximumConnections:      1000,
		RejectInvalidRecipients: false,
	}
}
DefaultSMTPPolicySet defines the default ServerPolicySet for an SMTP server
package config
import (
	"encoding/json"
	"flag"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"github.com/mailhog/backends/config"
)
func DefaultConfig() *Config {
	return &Config{
		Backends: map[string]config.BackendConfig{
			"local_auth": config.BackendConfig{
				Type: "local",
				Data: map[string]interface{}{
					"config": "auth.json",
				},
			},
			"local_resolver": config.BackendConfig{
				Type: "local",
				Data: map[string]interface{}{
					"config": "resolve.json",
				},
			},
			"local_delivery": config.BackendConfig{
				Type: "local",
				Data: map[string]interface{}{},
			},
		},
		Servers: []*Server{
			&Server{
				BindAddr:  "0.0.0.0:25",
				Hostname:  "mailhog.example",
				PolicySet: DefaultSMTPPolicySet(),
				Backends: Backends{
					Auth: &config.BackendConfig{
						Ref: "local_auth",
					},
					Resolver: &config.BackendConfig{
						Ref: "local_resolver",
					},
					Delivery: &config.BackendConfig{
						Ref: "local_delivery",
					},
				},
			},
			&Server{
				BindAddr:  "0.0.0.0:587",
				Hostname:  "mailhog.example",
				PolicySet: DefaultSubmissionPolicySet(),
				Backends: Backends{
					Auth: &config.BackendConfig{
						Ref: "local_auth",
					},
					Resolver: &config.BackendConfig{
						Ref: "local_resolver",
					},
					Delivery: &config.BackendConfig{
						Ref: "local_delivery",
					},
				},
			},
		},
	}
}
type Config struct {
	relPath string
	Servers  []*Server                       `json:",omitempty"`
	Backends map[string]config.BackendConfig `json:",omitempty"`
}
func (c Config) RelPath() string {
	return c.relPath
}
type Server struct {
	BindAddr  string          `json:",omitempty"`
	Hostname  string          `json:",omitempty"`
	PolicySet ServerPolicySet `json:",omitempty"`
	Backends  Backends        `json:",omitempty"`
	TLSConfig TLSConfig       `json:",omitempty"`
}
type TLSConfig struct {
	CertFile string `json:",omitempty"`
	KeyFile  string `json:",omitempty"`
}
type ServerPolicySet struct {
	RequireAuthentication bool
	RequireLocalDelivery bool
	MaximumRecipients int
	DisableTLS bool
	RequireTLS bool
	MaximumLineLength int
	MaximumConnections int
	RejectInvalidRecipients bool
}
type Backends struct {
	Auth     *config.BackendConfig `json:",omitempty"`
	Resolver *config.BackendConfig `json:",omitempty"`
	Delivery *config.BackendConfig `json:",omitempty"`
}
func DefaultSubmissionPolicySet() ServerPolicySet {
	return ServerPolicySet{
		RequireAuthentication:   true,
		RequireLocalDelivery:    false,
		MaximumRecipients:       500,
		DisableTLS:              false,
		RequireTLS:              true,
		MaximumLineLength:       1024000,
		MaximumConnections:      1000,
		RejectInvalidRecipients: false,
	}
}