Skip to content

karlpilkington/smtpd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smtpd is a Go package for handling the server side of the SMTP protocol.
It does not handle high level details like what addresses should be
accepted or what should happen with email once it has been fully received;
those decisions are instead delegated to whatever is driving smtpd.
Smtpd's purpose is simply to handle the grunt work of a reasonably
RFC compliant SMTP server, taking care of things like proper command
sequencing, TLS, and basic correctness of some things.

(The standard library net/smtp package handles only the client side
of SMTP; it makes no attempt to provide the facilities you'd need to
write a server.)

smtpd comes with a 'sinkhole' SMTP server that simply takes in email
(perhaps) and doesn't do anything with it beyond perhaps writing it to
disk. This is obviously not suitable for production usage but it does
make a potentially useful sink for spammers (which is what the author
uses it for). This is cmd/sinksmtp.go; see the comments at the start
and also cmd/doc.go for how to run it.

Because of its origin as the core engine of a sinkhole SMTP server,
smtpd is pretty casual about a lot of things in the SMTP protocol
and in what information it hands to higher layers; for example, it
basically ignores SMTP parameters on MAIL FROM and RCPT TO. It will
accept far longer command lines than are required by the RFC, it has
shorter timeouts than the RFC requires (although you can change that),
and it is somewhat slapdash in doing basic sanity checking on addresses
(the author declines to write an RFC 5321 address parser just to be
fully correct, and yes it's a pity that this part of net/mail is not
exported and no, we're not faking things up so we can use net/mail's
version). These are all defects but the odds of the author fixing them
are low because his sinkhole SMTP server doesn't currently need them.

(Pull requests are welcome.)

Smtpd supports PIPELINING by paying no attention to people who do it
anyways and supports STARTTLS if you provide a certificate and a key.
It advertises 8BITMIME and accepts the relevant MAIL FROM parameter;
regardless of what clients do, messages are received in all 8 bits.
It rejects VRFY and EXPN attempts. It supports AUTH if you configure
one or more authentication methods.

References:
	http://tools.ietf.org/html/rfc5321
	http://golang.org/pkg/net/smtp/

See also:
	https://github.com/flashmob/go-guerrilla

Go-Guerilla SMTPd requires a real database server and is less RFC
neurotic than smtpd (eg it assumes that clients always send commands in
the right order). It's also a monolithic program instead of a package
that you can reuse.

CREDITS

Chris Siebenmann https://github.com/siebenmann
started writing this.

Felix Lange https://github.com/fjl contributed SMTP AUTH support.

COPYRIGHT:
GPL v3 for now

About

A Go package to handle the server side of SMTP, with a sample simple SMTP server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.9%
  • Makefile 0.1%