public static bool SendRegisterMail(fields model)
 {
     var username = ConfigurationManager.AppSettings["MailUser"];
     var pwd = ConfigurationManager.AppSettings["MailPWD"];
     var host = ConfigurationManager.AppSettings["Mailhost"];
     var json = JsonConvert.SerializeObject(model);
     //Convert.FromBase64String(token);解码
     var base64 = Convert.ToBase64String(System.Text.Encoding.Default.GetBytes(json));
     var url = "http://" + HttpContext.Current.Request.Url.Host + "/Home/VerifyEmail/" + "?code=" + base64;
     return SendMail(username, pwd, model.email, host, "Confirmation of registration", url, string.Empty);
 }
        public object Post(fields model)
        {
            var response = new ResponseModel
            {
                Error = false,
                Message = "succeed, Some minutes later you'll get an e-mail at the address provided containing a link in it."
            };
            try
            {
                MailHelper.SendRegisterMail(model);
            }
            catch (Exception ex)
            {
                response.Error = true;
                response.Message = ex.Message;
            }

            return response;
        }