func GetMail(writer http.ResponseWriter, request *http.Request) {
	vars := mux.Vars(request)
	log := context.Get(request, "log").(*logging.Logger)
	database := context.Get(request, "database").(storage.IStorage)
	var mailID string
	var mailItem mailitem.MailItem
	var err error
	var ok bool
	if mailID, ok = vars["mailID"]; !ok {
		log.Error("Invalid mail ID passed to GetMail")
		GoHttpService.BadRequest(writer, "A valid mail ID is required")
		return
	}
	if mailItem, err = database.GetMailByID(mailID); err != nil {
		log.Errorf("Problem getting mail item in GetMail - %s", err.Error())
		GoHttpService.Error(writer, "Problem getting mail item")
		return
	}
	log.Infof("Mail item %s retrieved", mailID)
	result := &response.MailItemResponse{
		MailItem: mailItem,
	}
	GoHttpService.WriteJson(writer, result, 200)
}
/*
GetMail returns a single mail item by ID.

GET: /mail/{id}
package controllers
import (
	"math"
	"net/http"
	"strconv"
	"github.com/adampresley/GoHttpService"
	"github.com/adampresley/logging"
	"github.com/mailslurper/libmailslurper/model/mailitem"
	"github.com/mailslurper/libmailslurper/model/requests"
	"github.com/mailslurper/libmailslurper/model/response"
	"github.com/mailslurper/libmailslurper/model/search"
	"github.com/mailslurper/libmailslurper/storage"
	"github.com/gorilla/context"
	"github.com/gorilla/mux"
)
func DeleteMail(writer http.ResponseWriter, request *http.Request) {
	var err error
	deleteRequest := &requests.DeleteMailRequest{}
	log := context.Get(request, "log").(*logging.Logger)
	database := context.Get(request, "database").(storage.IStorage)
	if err = GoHttpService.ParseJsonBody(request, deleteRequest); err != nil {
		log.Errorf("Invalid delete mail request - %s", err.Error())
		GoHttpService.BadRequest(writer, "Invalid delete mail request")
		return
	}
	if !deleteRequest.PruneCode.IsValid() {
		log.Errorf("Attempt to use invalid prune code - %s", deleteRequest.PruneCode)
		GoHttpService.BadRequest(writer, "Invalid prune type")
		return
	}
	startDate := deleteRequest.PruneCode.ConvertToDate()
	if err = database.DeleteMailsAfterDate(startDate); err != nil {
		log.Errorf("Problem deleting mails - %s", err.Error())
		GoHttpService.Error(writer, "There was a problem deleting mails")
		return
	}
	log.Infof("Deleting mails, code %s - Start - %s", deleteRequest.PruneCode.String(), startDate)
	GoHttpService.Success(writer, "OK")
}