public async Task SendMessage(EmailModel model) {
      var client = await EnsureClientCreated();


      var message = new Message() {
        Subject = model.Subject,
        Body = new ItemBody() { Content = model.Body, ContentType = BodyType.HTML }
      };
      message.ToRecipients.Add(new Recipient() {
        EmailAddress = new EmailAddress { Address = model.Recipient }
      });

      await client.Me.Messages.AddMessageAsync(message);
    }
 public async Task<ActionResult> ComposeMessage(EmailModel model) {
   MailRepository repo = new MailRepository();
   await repo.SendMessage(model);
   return RedirectToAction("Index");
 }
 public ActionResult ComposeMessage(string recipient) {
   EmailModel newModel = new EmailModel() { Recipient = recipient };
   return View(newModel);
 }