func PostEmailWebhook(w http.ResponseWriter, r *http.Request, matcher *matching.Matcher, mondoApiClient *mondo.MondoApiClient) {
	defer r.Body.Close()
	var request = &email.Email{}
	err := json.NewDecoder(r.Body).Decode(request)
	if err != nil {
		http.Error(w, err.Error(), http.StatusBadRequest)
		log.Printf("json parse error: %s\n", err.Error())
		return
	}

	vendorMatchKey := getVendorMatchKey(request.Subject)
	if vendorMatchKey == "" {
		log.Printf("ignored unrecognised vendor")
		return
	}

	bodyHtml, err := request.HTML()
	if err != nil {
		http.Error(w, err.Error(), http.StatusBadRequest)
		log.Printf("html decode error: %s\n", err.Error())
		return
	}

	transaction := &matching.Email{
		MessageId:         request.Id,
		Subject:           request.Subject,
		BodyHtml:          bodyHtml,
		BodyHtmlBase64Url: base64.URLEncoding.EncodeToString([]byte(bodyHtml)),
		VendorMatchKey:    vendorMatchKey,
	}

	match := matcher.MatchEmail(transaction)
	if match == nil {
		return
	}

	err = uploadAttachment(mondoApiClient, match.Transaction.Id, match.Email.BodyHtmlBase64Url)
	if err != nil {
		http.Error(w, err.Error(), http.StatusBadRequest)
		log.Printf("upload error: %s\n", err.Error())
		return
	}
}