Documentation ¶
Index ¶
Constants ¶
View Source
const ( SMTP_CRLF string = "\r\n" SMTP_DATA_TERMINATOR string = "\r\n.\r\n" SMTP_WELCOME_MESSAGE string = "220 Welcome to MailSlurper!" SMTP_CLOSING_MESSAGE string = "221 Bye" SMTP_OK_MESSAGE string = "250 Ok" SMTP_DATA_RESPONSE_MESSAGE string = "354 End data with <CR><LF>.<CR><LF>" SMTP_HELLO_RESPONSE_MESSAGE string = "250 Hello. How very nice to meet you!" )
View Source
const ( SMTP_WORKER_IDLE SmtpWorkerState = 0 SMTP_WORKER_WORKING SmtpWorkerState = 1 SMTP_WORKER_DONE SmtpWorkerState = 100 SMTP_WORKER_ERROR SmtpWorkerState = 101 RECEIVE_BUFFER_LEN = 1024 CONN_TIMEOUT_MILLISECONDS = 5 COMMAND_TIMEOUT_SECONDS = 5 )
Variables ¶
View Source
var SmtpCommands = map[string]SmtpCommand{ "helo": HELO, "ehlo": HELO, "rcpt to": RCPT, "mail from": MAIL, "send": MAIL, "rset": RSET, "quit": QUIT, "data": DATA, }
This is a command map of SMTP command strings to their int representation. This is primarily used because there can be more than one command to do the same things. For example, a client can send "helo" or "ehlo" to initiate the handshake.
View Source
var SmtpCommandsToStrings = map[SmtpCommand]string{ HELO: "HELO", RCPT: "RCPT TO", MAIL: "SEND", RSET: "RSET", QUIT: "QUIT", DATA: "DATA", }
Friendly string representations of commands. Useful in error reporting.
Functions ¶
This section is empty.
Types ¶
type SmtpCommand ¶
type SmtpCommand int
const ( NONE SmtpCommand = iota RCPT SmtpCommand = iota MAIL SmtpCommand = iota HELO SmtpCommand = iota RSET SmtpCommand = iota DATA SmtpCommand = iota QUIT SmtpCommand = iota )
Constants representing the commands that an SMTP client will send during the course of communicating with our server.
func GetCommandFromString ¶
func GetCommandFromString(input string) (SmtpCommand, error)
Takes a string and returns the integer command representation. For example if the string contains "DATA" then the value 1 (the constant DATA) will be returned.
func (SmtpCommand) String ¶
func (this SmtpCommand) String() string
Returns the string representation of a command.
type SmtpWorkerState ¶
type SmtpWorkerState int
Click to show internal directories.
Click to hide internal directories.