func setBody(mail *sendgrid.SGMail, event *Event) (*sendgrid.SGMail, error) { if event.Body == nil { return nil, ErrSendgridBodyEmpty } bodyType := event.Body.Type switch bodyType { case HtmlBodyType: mail.SetHTML(event.Body.Content) case TextBodyType: mail.SetText(event.Body.Content) } return mail, nil }