func (s *StoreStub) RemoveMessage(mailbox, id string) error {
	mb, ok := s.mailboxes[mailbox]
	if ok {
		var msg storage.Message
		for i, m := range mb {
			if m.ID() == id {
				msg = m
				s.mailboxes[mailbox] = append(mb[:i], mb[i+1:]...)
				break
			}
		}
		if msg != nil {
			s.deleted[msg] = struct{}{}
			return nil
		}
	}
	return storage.ErrNotExist
}
RemoveMessage deletes a message by ID from the specified mailbox.
package test
import (
	"errors"
	"github.com/inbucket/inbucket/pkg/storage"
)
type StoreStub struct {
	storage.Store
	mailboxes map[string][]storage.Message
	deleted   map[storage.Message]struct{}
}
func NewStore() *StoreStub {
	return &StoreStub{
		mailboxes: make(map[string][]storage.Message),
		deleted:   make(map[storage.Message]struct{}),
	}
}
func (s *StoreStub) AddMessage(m storage.Message) (id string, err error) {
	mb := m.Mailbox()
	msgs := s.mailboxes[mb]
	s.mailboxes[mb] = append(msgs, m)
	return m.ID(), nil
}
func (s *StoreStub) GetMessage(mailbox, id string) (storage.Message, error) {
	if mailbox == "messageerr" {
		return nil, errors.New("internal error")
	}
	for _, m := range s.mailboxes[mailbox] {
		if m.ID() == id {
			return m, nil
		}
	}
	return nil, storage.ErrNotExist
}
func (s *StoreStub) GetMessages(mailbox string) ([]storage.Message, error) {
	if mailbox == "messageserr" {
		return nil, errors.New("internal error")
	}
	return s.mailboxes[mailbox], nil
}