GithubHelp home page GithubHelp logo

my-smtp-proxy's Introduction

Original code from mailhog

data

MailHog data library GoDoc Build Status

github.com/mailhog/data implements a data library

Licence

Copyright ©‎ 2014-2015, Ian Kent (http://iankent.uk)

Released under MIT license, see LICENSE for details.

http

MailHog HTTP utilities GoDoc Build Status

github.com/mailhog/http provides HTTP utilities used by MailHog-UI and MailHog-Server.

Licence

Copyright ©‎ 2014-2015, Ian Kent (http://iankent.uk)

Released under MIT license, see LICENSE for details.

mhsendmail

mhsendmail

A sendmail replacement which forwards mail to an SMTP server.

> go get github.com/mailhog/mhsendmail

> mhsendmail [email protected] <<EOF
From: App <[email protected]>
To: Test <[email protected]>
Subject: Test message

Some content!
EOF

You can also set the from address (for SMTP MAIL FROM):

./mhsendmail --from="[email protected]" [email protected] ...

Or pass in multiple recipients:

Or override the destination SMTP server:

./mhsendmail --smtp-addr="localhost:1026" [email protected] ...

To use from php.ini

sendmail_path = /usr/local/bin/mhsendmail

Licence

Copyright ©‎ 2015 - 2016, Ian Kent (http://iankent.uk)

Released under MIT license, see LICENSE for details.

server

MailHog Server Build Status

MailHog-Server is the MailHog SMTP and HTTP API server.

Licence

Copyright ©‎ 2014 - 2016, Ian Kent (http://iankent.uk)

Released under MIT license, see LICENSE for details.

smtp

MailHog SMTP Protocol GoDoc Build Status

github.com/mailhog/smtp implements an SMTP server state machine.

It attempts to encapsulate as much of the SMTP protocol (plus its extensions) as possible without compromising configurability or requiring specific backend implementations.

proto := NewProtocol()
reply := proto.Start()
reply = proto.ProcessCommand("EHLO localhost")
// ...

See MailHog-Server and MailHog-MTA for example implementations.

Commands and replies

Interaction with the state machine is via:

  • the Parse function
  • the ProcessCommand and ProcessData functions

You can mix the use of all three functions as necessary.

Parse

Parse should be used on a raw text stream. It looks for an end of line (\r\n), and if found, processes a single command. Any unprocessed data is returned.

If any unprocessed data is returned, Parse should be called again to process then next command.

text := "EHLO localhost\r\nMAIL FROM:<test>\r\nDATA\r\nTest\r\n.\r\n"

var reply *smtp.Reply
for {
  text, reply = proto.Parse(text)
  if len(text) == 0 {
    break
  }
}

ProcessCommand and ProcessData

ProcessCommand should be used for an already parsed command (i.e., a complete SMTP "line" excluding the line ending).

ProcessData should be used if the protocol is in DATA state.

reply = proto.ProcessCommand("EHLO localhost")
reply = proto.ProcessCommand("MAIL FROM:<test>")
reply = proto.ProcessCommand("DATA")
reply = proto.ProcessData("Test\r\n.\r\n")

Hooks

The state machine provides hooks to manipulate its behaviour.

See GoDoc for more information.

Hook Description
LogHandler Called for every log message
MessageReceivedHandler Called for each message received
ValidateSenderHandler Called after MAIL FROM
ValidateRecipientHandler Called after RCPT TO
ValidateAuthenticationHandler Called after AUTH
SMTPVerbFilter Called for every SMTP command processed
TLSHandler Callback mashup called after STARTTLS
GetAuthenticationMechanismsHandler Called for each EHLO command

Behaviour flags

The state machine also exports variables to control its behaviour:

See GoDoc for more information.

Variable Description
RejectBrokenRCPTSyntax Reject non-conforming RCPT syntax
RejectBrokenMAILSyntax Reject non-conforming MAIL syntax
RequireTLS Require STARTTLS before other commands
MaximumRecipients Maximum recipients per message
MaximumLineLength Maximum length of SMTP line

Licence

Copyright ©‎ 2014-2015, Ian Kent (http://iankent.uk)

Released under MIT license, see LICENSE for details.

storage

MailHog storage backends GoDoc Build Status

github.com/mailhog/storage implements MailHog storage backends:

  • In-memory
  • MongoDB

You should implement storage.Storage interface to provide your own storage backend.

Licence

Copyright ©‎ 2014 - 2016, Ian Kent (http://iankent.uk)

Released under MIT license, see LICENSE for details.

ui

MailHog UI Build Status

MailHog-UI is the MailHog web based user interface.

Licence

Copyright ©‎ 2014 - 2016, Ian Kent (http://iankent.uk)

Released under MIT license, see LICENSE for details.

my-smtp-proxy's People

Contributors

mevtho avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.