package smtp import "fmt" // reply schreibt eine einzeilige SMTP-Antwort "code text\r\n". func (s *Session) reply(code int, text string) error { if _, err := fmt.Fprintf(s.writer, "%d %s\r\n", code, text); err != nil { return err } return s.writer.Flush() } // replyMultiline schreibt eine mehrzeilige SMTP-Antwort (z. B. EHLO- // Capability-Liste): alle Zeilen außer der letzten mit "-" statt " " // nach dem Code (RFC 5321 §4.2.1). func (s *Session) replyMultiline(code int, lines []string) error { for i, line := range lines { sep := "-" if i == len(lines)-1 { sep = " " } if _, err := fmt.Fprintf(s.writer, "%d%s%s\r\n", code, sep, line); err != nil { return err } } return s.writer.Flush() }