Browse Source

discard dot suffix from data input (#25)

* add data to dummy backend log

* discard dot suffix from data input
Guerrilla Mail 8 years ago
parent
commit
fa3fb457fd
2 changed files with 3 additions and 1 deletions
  1. 1 1
      backends/dummy.go
  2. 2 0
      server/smtpd.go

+ 1 - 1
backends/dummy.go

@@ -39,7 +39,7 @@ func (b *DummyBackend) Finalize() error {
 
 func (b *DummyBackend) Process(client *guerrilla.Client, from *guerrilla.EmailParts, to []*guerrilla.EmailParts) string {
 	if b.config.LogReceivedMails {
-		log.Infof("Mail from: %s / to: %v", from, to)
+		log.Infof("Mail from: %s / to: %v data:[%s]", from, to, client.Data)
 	}
 	return fmt.Sprintf("250 OK : queued as %s", client.Hash)
 }

+ 2 - 0
server/smtpd.go

@@ -253,6 +253,8 @@ func (server *SmtpdServer) readSmtp(client *guerrilla.Client) (input string, err
 			break
 		}
 		if strings.HasSuffix(input, suffix) {
+			// discard the suffix and stop reading
+			input = input[0:len(input)-len(suffix)]
 			break
 		}
 	}