func (s *Session) Mail(from string, opts smtp.MailOptions) error {
	// If running in gateway mode then it will check that the sender
	// is from outside bitmaelum network
	if s.IsGateway {
		if !isEmailValid(from) {
			logrus.Tracef("SMTP: discarding incoming mail from %s, invalid address", from)
			return errInvalidAddress
		}

		// Check that the mails comes from outside
		if isEmailFromBitMaelumNetwork(s.From) {
			logrus.Tracef("SMTP: discarding incoming mail from %s, the email is coming from inside", from)
			return nil
		}

		s.From = from
		return nil
	}

	from = common.EmailToAddr(from)

	if s.Account == "" {
		var err error
		s.Info, s.Client, err = common.GetClientAndInfo(s.Vault, from)
		if err != nil {
			return err
		}
	}

	if from != s.Info.Address.String() {
		return errInvalidFrom
	}

	s.From = from

	return nil
}
// Mail is called when doing a "MAIL FROM:"
Mail is called when doing a "MAIL FROM:"
// Mail is called when doing a " MAIL FROM : "
func (s *Session) Mail(from string, opts smtp.MailOptions) error {
	if s.IsGateway {
		if !isEmailValid(from) {
			logrus.Tracef("SMTP: discarding incoming mail from %s, invalid address", from)
			return errInvalidAddress
		}
		if isEmailFromBitMaelumNetwork(s.From) {
			logrus.Tracef("SMTP: discarding incoming mail from %s, the email is coming from inside", from)
			return nil
		}
		s.From = from
		return nil
	}
	from = common.EmailToAddr(from)
	if s.Account == "" {
		var err error
		s.Info, s.Client, err = common.GetClientAndInfo(s.Vault, from)
		if err != nil {
			return err
		}
	}
	if from != s.Info.Address.String() {
		return errInvalidFrom
	}
	s.From = from
	return nil
}
func ( s * Session ) Mail ( from string , opts smtp . MailOptions ) error { if s . IsGateway { if ! isEmailValid ( from ) { logrus . Tracef ( " " , from ) return errInvalidAddress } if isEmailFromBitMaelumNetwork ( s . From ) { logrus . Tracef ( " " , from ) return nil } s . From = from return nil } from = common . EmailToAddr ( from ) if s . Account == " " { var err error s . Info , s . Client , err = common . GetClientAndInfo ( s . Vault , from ) if err != nil { return err } } if from != s . Info . Address . String ( ) { return errInvalidFrom } s . From = from return nil }
Mail is called when doing a "MAIL FROM:"
Mail is called when doing a " MAIL FROM : "
// If running in gateway mode then it will check that the sender // is from outside bitmaelum network // Check that the mails comes from outside