Git Product home page Git Product logo

go-smtpsrv's Introduction

A SMTP Server Package

a simple smtp server library for writing email servers like a boss.

Quick Start

go get github.com/alash3al/go-smtpsrv

package main

import (
	"fmt"

	"github.com/alash3al/go-smtpsrv/v3"
)

func main() {
	handler := func(c smtpsrv.Context) error {
		// ...
		return nil
	}

	cfg := smtpsrv.ServerConfig{
		BannerDomain:  "mail.my.server",
		ListenAddr: ":25025",
		MaxMessageBytes: 5 * 1024,
		Handler:     handler,
	}

	fmt.Println(smtpsrv.ListenAndServe(&cfg))
}

Thanks

go-smtpsrv's People

Contributors

alash3al avatar flaviobarros avatar lcd1232 avatar murphysean avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

go-smtpsrv's Issues

how use this?

i'am try use smtpsrv,but i try send mail to smtp server.error is email-address error.

said: 501 MAIL command contained invalid address (in reply to MAIL FROM command)

please help me

SPF validation is wrong

Hey
the SPF validation does not work. And I think it's broken for everyone if I see it correctly. This is the code:

go-smtpsrv/context.go

Lines 60 to 66 in d1b581b

func (c Context) SPF() (SPFResult, string, error) {
_, host, err := SplitAddress(c.From().Address)
if err != nil {
return spf.None, "", err
}
return spf.CheckHost(net.ParseIP(c.RemoteAddr().String()), host, c.From().Address)

The problem is that c.RemoteAddr() contains also the port (1.2.3.4:32152) and so net.ParseIP will fail and return nil. This is what happens at least in my case.

354 End data with <CR><LF>.<CR><LF> is broken

Using logrus_mail to send email via smtpsrv results in "503 Bad sequence of commands".

Verified manually:

Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 localhost ESMTP
EHLO localhost
250-Greets localhost
250-PIPELINING
250-SMTPUTF8
250 8BITMIME
MAIL FROM:[email protected]
250 Ok
RCPT TO:[email protected]
250 Ok
DATA
354 End data with .
250 OK
Subject: Random Test

Test test

{}

.

500 Command not recognized ()
.
500 Command not recognized (.)

Here's Wireshark reconstruction of the actual app communication (and erroring):
Screenshot 2019-06-26 at 11 03 53 PM

Charset issue with Windows-1252 (and other ones ?)

As I explained here : alash3al/smtp2http#14

There is an issue with ioutil.ReadAll reading bytes of some mail contents in french mails with accents.

It should be better to detect charset in Content-Type and correctly decode with charmap for example.

I m not used in Go programming. I don't think I'm gonna be able to help you fixing this.

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.