Giter VIP home page Giter VIP logo

msmtpd's Introduction

msmtpd

PkgGoDev Go Report Card Go

Golang framework for building Simple Mail Transfer Protocol Daemons.

Фреймворк для создания почтовых серверов, написанный на Go.

Mirrors

Main features

  1. Haraka hooks inspired CheckerFunc's being called on different actions of client (connection, HELO/EHLO command, StartTLS)
  2. StartTLS, XClient, Proxy command support
  3. Easy to implement logger interface
  4. Build-in OpenTelemetry support - see dovecot_inbound and dovecot_outbound examples
  5. Lot of plugins, including:
  6. Dovecot plugin for authentication and LMTP mail delivery
  7. Rspamd plugin for blocking spam
  8. Plugins to deliver via 3rd party SMTP proxy, LMTP and SendMail.
  9. Experimental Karma plugin to implement connection scoring (IP addresses making failed SMTP transactions will be blacklisted)
  10. HELO/EHLO checkers, including complicated ones
  11. Sender resolvable checker plugin to ensure sender's domain can accept our replies

Examples / Примеры

Inspiration / Источники вдохновения

Minimal example / Минимальный пример

package main

import (
	"log"

	"github.com/vodolaz095/msmtpd"
)

func main() {
	server := msmtpd.Server{
		Hostname:       "localhost",
		WelcomeMessage: "Do you believe in our God?",
	}

	err := server.ListenAndServe(":1025")
	if err != nil {
		log.Fatalf("%s : while starting server on 0.0.0.0:1025", err)
	}
}

Server log / Протокол работы сервера

2023/08/02 16:30:11 INFO [1cca484c18ebe494240b196bc60ee39c]: Accepting connection from [::1]:34142...
2023/08/02 16:30:11 INFO [1cca484c18ebe494240b196bc60ee39c]: EHLO <localhost> is accepted!
2023/08/02 16:30:11 INFO [1cca484c18ebe494240b196bc60ee39c]: MAIL FROM <[email protected]> is checked by 0
SenderCheckers and accepted!
2023/08/02 16:30:11 INFO [1cca484c18ebe494240b196bc60ee39c]: Recipient <[email protected]> will be 1st one in
transaction!
2023/08/02 16:30:11 INFO [1cca484c18ebe494240b196bc60ee39c]: Subject: test Wed, 02 Aug 2023 16:30:11 +0300
2023/08/02 16:30:11 INFO [1cca484c18ebe494240b196bc60ee39c]: Body (264 bytes) checked by 0 DataCheckers successfully!
2023/08/02 16:30:11 WARN [1cca484c18ebe494240b196bc60ee39c]: Message silently discarded - no DataHandlers set...
2023/08/02 16:30:12 INFO [1cca484c18ebe494240b196bc60ee39c]: Closing transaction.
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: Accepting connection from [::1]:50596...
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: EHLO <localhost> is accepted!
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: MAIL FROM <[email protected]> is checked by 0
SenderCheckers and accepted!
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: Recipient <[email protected]> will be 1st one in
transaction!
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: Recipient <[email protected]> will be 2nd one in
transaction!
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: Recipient <[email protected]> will be 2nd one in
transaction!
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: Recipient <[email protected]> will be 4th one in
transaction!
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: Subject: test Wed, 02 Aug 2023 16:30:31 +0300
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: Body (334 bytes) checked by 0 DataCheckers successfully!
2023/08/02 16:30:31 WARN [4dfe768e04186309306b1af3194b05c4]: Message silently discarded - no DataHandlers set...
2023/08/02 16:30:31 INFO [4dfe768e04186309306b1af3194b05c4]: Closing transaction.

Client log while testing smtp server / Вывод клиента при тестировании почтового сервера

$ swaks --to [email protected],[email protected],[email protected],[email protected] \
    --from [email protected] \
    --server localhost --port 1025 \
    --timeout 600
=== Trying localhost:1025...
=== Connected to localhost.
<- 220 Do you believe in our God?
-> EHLO localhost
<- 250-localhost
<- 250-SIZE 10240000
<- 250-8BITMIME
<- 250 PIPELINING
-> MAIL FROM:<[email protected]>
<- 250 Ok, it makes sense, go ahead please!
-> RCPT TO:<[email protected]>
<- 250 It seems i can handle delivery for this recipient, i'll do my best!
-> RCPT TO:<[email protected]>
<- 250 It seems i can handle delivery for this recipient, i'll do my best!
-> RCPT TO:<[email protected]>
<- 250 It seems i can handle delivery for this recipient, i'll do my best!
-> RCPT TO:<[email protected]>
<- 250 It seems i can handle delivery for this recipient, i'll do my best!
-> DATA
<- 354 Ok, you managed to talk me into accepting your message. Go on, end your data with <CR><LF>.<CR><LF>
-> Date: Wed, 02 Aug 2023 16:30:31 +0300
-> To: [email protected],[email protected],[email protected],[email protected]
-> From: [email protected]
-> Subject: test Wed, 02 Aug 2023 16:30:31 +0300
-> Message-Id: <20230802163031.059039@localhost>
-> X-Mailer: swaks v20190914.0 jetmore.org/john/code/swaks/
->
-> This is a test mailing
->
->
-> .
<- 250 Thank you.
-> QUIT
<- 221 Farewell, my friend! Transaction 4dfe768e04186309306b1af3194b05c4 is finished

Support development / Поддержать разработку

https://www.tinkoff.ru/rm/ostroumov.anatoliy2/4HFzm76801/

msmtpd's People

Contributors

vodolaz095 avatar

Watchers

 avatar  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.