func (s *Session) Data(r io.Reader) error {
	if s.IsGateway {
		// Since mail is from outside, at least check SPF record
		parts := strings.Split(s.From, "@")
		res := spf.CheckHost(net.ParseIP(strings.Split(s.RemoteAddr.String(), ":")[0]), parts[1], s.From, "")
		if res != spf.Pass {
			logrus.Tracef("SMTP: discarding incoming mail from %s, SPF did not pass", s.From)
			return errSPFnotPass
		}
	}

	logrus.Infof("SMTP: processing incoming email. From: %s, To: %s", s.From, s.To)

	return s.sendTo(r)
}
// Data is called when doing a "DATA"
Data is called when doing a "DATA"
// Data is called when doing a " DATA "
func (s *Session) Data(r io.Reader) error {
	if s.IsGateway {
		parts := strings.Split(s.From, "@")
		res := spf.CheckHost(net.ParseIP(strings.Split(s.RemoteAddr.String(), ":")[0]), parts[1], s.From, "")
		if res != spf.Pass {
			logrus.Tracef("SMTP: discarding incoming mail from %s, SPF did not pass", s.From)
			return errSPFnotPass
		}
	}
	logrus.Infof("SMTP: processing incoming email. From: %s, To: %s", s.From, s.To)
	return s.sendTo(r)
}
func ( s * Session ) Data ( r io . Reader ) error { if s . IsGateway { parts := strings . Split ( s . From , " " ) res := spf . CheckHost ( net . ParseIP ( strings . Split ( s . RemoteAddr . String ( ) , " " ) [ 0 ] ) , parts [ 1 ] , s . From , " " ) if res != spf . Pass { logrus . Tracef ( " " , s . From ) return errSPFnotPass } } logrus . Infof ( " " , s . From , s . To ) return s . sendTo ( r ) }
Data is called when doing a "DATA"
Data is called when doing a " DATA "
// Since mail is from outside, at least check SPF record