func deliverLocal(addrInfo *resolver.AddressInfo, msgID string, header *message.Header) error {
	// Check the serverSignature
	if !message.VerifyServerHeader(*header) {
		logrus.Errorf("message %s destined for %s has failed the server signature check. Seems that this message did not originate from the original mail server. Removing the message.", msgID, header.To.Addr)

		err := message.RemoveMessage(message.SectionProcessing, msgID)
		if err != nil {
			// @TODO: we should notify somebody?
			logrus.Warnf("cannot remove message %s from the process queue.", msgID)
		}

		return nil
	}

	// Check the clientSignature
	if !message.VerifyClientHeader(*header) {
		logrus.Errorf("message %s destined for %s has failed the client signature check. Seems that this message may have been spoofed. Removing the message.", msgID, header.To.Addr)

		err := message.RemoveMessage(message.SectionProcessing, msgID)
		if err != nil {
			// @TODO: we should notify somebody?
			logrus.Warnf("cannot remove message %s from the process queue.", msgID)
		}

		return nil
	}

	// Deliver mail to local user inbox
	h, err := hash.NewFromHash(addrInfo.Hash)
	if err != nil {
		return err
	}

	// Add message
	ar := container.Instance.GetAccountRepo()
	err = ar.CreateMessage(*h, msgID)
	if err != nil {
		return err
	}

	// Move to inbox
	err = ar.AddToBox(*h, account.BoxInbox, msgID)
	if err != nil {
		return err
	}

	_ = dispatcher.DispatchLocalDelivery(*h, header, msgID)

	return nil
}
// deliverLocal moves a message to a local mailbox.
deliverLocal moves a message to a local mailbox.
// deliverLocal moves a message to a local mailbox .
func deliverLocal(addrInfo *resolver.AddressInfo, msgID string, header *message.Header) error {
	if !message.VerifyServerHeader(*header) {
		logrus.Errorf("message %s destined for %s has failed the server signature check. Seems that this message did not originate from the original mail server. Removing the message.", msgID, header.To.Addr)
		err := message.RemoveMessage(message.SectionProcessing, msgID)
		if err != nil {
			logrus.Warnf("cannot remove message %s from the process queue.", msgID)
		}
		return nil
	}
	if !message.VerifyClientHeader(*header) {
		logrus.Errorf("message %s destined for %s has failed the client signature check. Seems that this message may have been spoofed. Removing the message.", msgID, header.To.Addr)
		err := message.RemoveMessage(message.SectionProcessing, msgID)
		if err != nil {
			logrus.Warnf("cannot remove message %s from the process queue.", msgID)
		}
		return nil
	}
	h, err := hash.NewFromHash(addrInfo.Hash)
	if err != nil {
		return err
	}
	ar := container.Instance.GetAccountRepo()
	err = ar.CreateMessage(*h, msgID)
	if err != nil {
		return err
	}
	err = ar.AddToBox(*h, account.BoxInbox, msgID)
	if err != nil {
		return err
	}
	_ = dispatcher.DispatchLocalDelivery(*h, header, msgID)
	return nil
}
func deliverLocal ( addrInfo * resolver . AddressInfo , msgID string , header * message . Header ) error { if ! message . VerifyServerHeader ( * header ) { logrus . Errorf ( " " , msgID , header . To . Addr ) err := message . RemoveMessage ( message . SectionProcessing , msgID ) if err != nil { logrus . Warnf ( " " , msgID ) } return nil } if ! message . VerifyClientHeader ( * header ) { logrus . Errorf ( " " , msgID , header . To . Addr ) err := message . RemoveMessage ( message . SectionProcessing , msgID ) if err != nil { logrus . Warnf ( " " , msgID ) } return nil } h , err := hash . NewFromHash ( addrInfo . Hash ) if err != nil { return err } ar := container . Instance . GetAccountRepo ( ) err = ar . CreateMessage ( * h , msgID ) if err != nil { return err } err = ar . AddToBox ( * h , account . BoxInbox , msgID ) if err != nil { return err } _ = dispatcher . DispatchLocalDelivery ( * h , header , msgID ) return nil }
deliverLocal moves a message to a local mailbox.
deliverLocal moves a message to a local mailbox .
// Check the serverSignature // @TODO: we should notify somebody? // Check the clientSignature // @TODO: we should notify somebody? // Deliver mail to local user inbox // Add message // Move to inbox