mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 11:04:38 +03:00
add "mox localserve" subcommand, for running mox locally for email-related testing/developing
localserve creates a config for listening on localhost for imap/smtp/submission/http, on port numbers 1000 + the common service port numbers. all incoming email is accepted (if checks pass), and a few pattern in localparts are recognized and result in delivery errors.
This commit is contained in:
@ -72,6 +72,9 @@ var jitter = mox.NewRand()
|
||||
|
||||
var queueDB *bstore.DB
|
||||
|
||||
// Set for mox localserve, to prevent queueing.
|
||||
var Localserve bool
|
||||
|
||||
// Msg is a message in the queue.
|
||||
type Msg struct {
|
||||
ID int64
|
||||
@ -179,6 +182,11 @@ func Count() (int, error) {
|
||||
func Add(log *mlog.Log, senderAccount string, mailFrom, rcptTo smtp.Path, has8bit, smtputf8 bool, size int64, msgPrefix []byte, msgFile *os.File, dsnutf8Opt []byte, consumeFile bool) error {
|
||||
// todo: Add should accept multiple rcptTo if they are for the same domain. so we can queue them for delivery in one (or just a few) session(s), transferring the data only once. ../rfc/5321:3759
|
||||
|
||||
if Localserve {
|
||||
// Safety measure, shouldn't happen.
|
||||
return fmt.Errorf("no queuing with localserve")
|
||||
}
|
||||
|
||||
tx, err := queueDB.Begin(true)
|
||||
if err != nil {
|
||||
return fmt.Errorf("begin transaction: %w", err)
|
||||
|
Reference in New Issue
Block a user