当前位置: 首页>>代码示例>>C#>>正文


C# Functions.SendEmail方法代码示例

本文整理汇总了C#中Functions.SendEmail方法的典型用法代码示例。如果您正苦于以下问题:C# Functions.SendEmail方法的具体用法?C# Functions.SendEmail怎么用?C# Functions.SendEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Functions的用法示例。


在下文中一共展示了Functions.SendEmail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterUser

        public JsonResult RegisterUser(int ClientId, string NameSurname, string Email, string Password, string Phone, string DeviceId, string RawPW, string Address)
        {
            DeviceUser newUser = new DeviceUser(ClientId, DeviceId, NameSurname, Phone, Email, Password, Address);
            Client c = new Client();
            ClientRepository cr = new ClientRepository();
            c = cr.GetClient(Convert.ToInt32(ClientId));

            if (appRep.CheckDeviceUserRegistration(DeviceId, Phone, ClientId.ToString(), Password))
            {
                newUser.DeviceUserId = -1;
                var j = this.Json(newUser);
                return Json(j, JsonRequestBehavior.AllowGet);
            }
            else
            {
                //* In app, check if the DeviceUserId field != 0 for a successfull registration *//
                DeviceUser insertedUser = appRep.AddDeviceUser(newUser);

                if (insertedUser.DeviceUserId != 0)
                {
                    Functions f = new Functions();
                    f.SendEmail("You have been successfully registered. \n Registration details: \n Phone: " + Phone + " \n Password: " + RawPW + "\n\n Please keep this information safe, and do not delete this email.", Email, "Registration Details for: " + c.Name);

                    //...Send Email to Registrar
                    //Get Client Service Mail List
                    List<Settings> mails = setRep.GetSettings("registrar", ClientId);

                    if (mails.Count >= 1)
                    {
                        StringBuilder maillist = new StringBuilder();

                        foreach (Settings setting in mails)
                        {
                            maillist.Append(setting.Value).Append(",");
                        }
                        maillist.Remove(maillist.Length - 1, 1);

                        f.SendEmail("Please Approve:\n"+NameSurname, maillist.ToString(), "Netintercom User Request's Approval");
                    }
                }

                var j = this.Json(newUser);
                return Json(j, JsonRequestBehavior.AllowGet);
            }
        }
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:45,代码来源:AppRequestsController.cs

示例2: RequestService

        public ActionResult RequestService(int DeviceUserId, string ServiceRequest, string Query)
        {
            DeviceUserRepository DevURep = new DeviceUserRepository();
            ServicesRepository ServRep = new ServicesRepository();

            Services service = new Services();
            DeviceUser user = DevURep.GetDeviceUser(DeviceUserId);

            service.ClientId = user.ClientId;
            service.DeviceUserId = DeviceUserId;
            service.Service = ServiceRequest;
            service.Query = Query;
            service.ModifiedDate = DateTime.Now;

            StringBuilder w = new StringBuilder();
            w.Append(user.Name).Append(" ").Append(user.Surname).Append("\n");
            w.Append("Address: ").Append(user.Address).Append("\n");
            w.Append("Contact Details: Phone - ").Append(user.Phone).Append(" Email - ").Append(user.Email).Append("\n");
            w.Append("Request: ").Append(service.Service);
            w.Append("\n").Append(service.Query);

            Services ins = ServRep.AddServices(service);

            if (ins.ServiceId != 0)
            {
                //Send email
                Functions f = new Functions();

                //Get Client Service Mail List
                List<Settings> mails = setRep.GetSettings("email", user.ClientId);

                if (mails.Count >= 1)
                {
                    StringBuilder maillist = new StringBuilder();

                    foreach (Settings setting in mails)
                    {
                        maillist.Append(setting.Value).Append(",");
                    }
                    maillist.Remove(maillist.Length - 1, 1);

                    f.SendEmail(w.ToString(), maillist.ToString(), service.Service);
                }
                return Content("Success", "text/html");
            }
            else
            {
                return Content("Fail", "text/html");
            }
        }
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:50,代码来源:AppRequestsController.cs

示例3: Mail

        public ActionResult Mail(FormCollection form)
        {
            Functions f = new Functions();
            string message = "Someone did something wrong";

            if (form.AllKeys.Count() > 3)
            {
                message = "Name: " + form["name"].ToString() + "\nEmail: " + form["email"].ToString() + "\nWebsite: " + form["website"].ToString() + "\n\nMessage:\n" + form["message"].ToString();
            }

            f.SendEmail(message, Constants.ContactUsEmail, "Netintercom [Web Request]");

            return RedirectToAction("Index");
        }
开发者ID:Ricium,项目名称:NIWZ_101,代码行数:14,代码来源:HomeController.cs


注:本文中的Functions.SendEmail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。