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


C# IEmailSender.SendMail方法代码示例

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


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

示例1: SendInvitation

        //Add an entry in the ACL, and send an invitation email
        public void SendInvitation(string email, Guid ProjectID, UserType userType, IEmailSender emailSender)
        {
            //Database access
            var db = new ApplicationDBContext();

            //make sure this isnt a duplicate
            if (db.UsersAccessProjects.Where(acl => acl.Email == email && acl.ProjectID == ProjectID).Count() == 0)
            {
                //Working with ACL
                var acl = new UsersAccessProjects();
                acl.Email = email;
                acl.invitationAccepted = false;
                acl.ProjectID = ProjectID;
                acl.UserID = null;

                //Save the ACL entry
                db.UsersAccessProjects.Add(acl);
                db.SaveChanges();

                //build an invitaion email
                string body;
                body = "You have been invited to a new project.\n";
                body += "Click the link to accept the invitation.\n";
                body += "http://northcarolinataxrecoverycalculator.apphb.com/Project/AcceptInvite/" + acl.ID;

                //send an invitaion email
                emailSender.SendMail(email, "You have been invited to a project", body);
            }
        }
开发者ID:kevinhicks,项目名称:NorthCarolinaTaxRecoveryCalculator,代码行数:30,代码来源:AccountServices.cs

示例2: SendInvitation

        /// <summary>
        /// Send an invition via email to the invited user to collaborate on a project
        /// </summary>
        /// <param name="acl"></param>
        /// <param name="emailSender"></param>
        public void SendInvitation(UsersAccessProjects acl, IEmailSender emailSender)
        {
            //build an invitaion email. this is dirty :(
            string body;
            body = "You have been invited to a new project.\n";
            body += "Click the link to accept the invitation.\n";
            body += "http://northcarolinataxrecoverycalculator.apphb.com/Project/AcceptInvite/" + acl.ID;

            //send an invitaion email
            emailSender.SendMail(acl.Email, "You have been invited to a project", body);
        }
开发者ID:kevinhicks,项目名称:NorthCarolinaTaxRecoveryCalculator,代码行数:16,代码来源:ProjectRepository.cs


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