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


C# IEmailService.SendAsync方法代码示例

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


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

示例1: ProcessPrivateMeetingNotifications

        public static void ProcessPrivateMeetingNotifications(ApplicationUser currentUser, List<Meeting> meetingsBooked,
            IEmailService emailService,
            ApplicationUserManager userManager, ApplicationRoleManager roleManager)
        {
            var studentConfirmationEmailMessage = Compose_Private_Booking_Email(currentUser, meetingsBooked, userManager,
                true);
            try
            {
                emailService.SendAsync(studentConfirmationEmailMessage);
                Log4NetHelper.Log("Send Message To Student: " + studentConfirmationEmailMessage.To, LogLevel.INFO,
                    "ProcessPrivateMeetingNotifications", meetingsBooked.First().Id,
                    "Tester", null);
            }
            catch (Exception ex)
            {
                Log4NetHelper.Log("Send Student Message Failed - ", LogLevel.ERROR, "Meetings",
                    meetingsBooked.First().Id,
                    "Tester", ex);
            }
            var instructorId = meetingsBooked.FirstOrDefault()?.InstructorId;
            var instructor = userManager.FindById(instructorId);

            //Roger todo only first instructor will get notification message;
            var instructorConfirmationEmailMessage = Compose_Private_Booking_Email(instructor, meetingsBooked,
                userManager, false);

            if (instructorConfirmationEmailMessage != null)
            {
                try
                {
                    emailService.SendAsync(instructorConfirmationEmailMessage);
                    Log4NetHelper.Log("Send Message To Instructor: " + instructorConfirmationEmailMessage.To,
                        LogLevel.INFO, "ProcessPrivateMeetingNotifications", meetingsBooked.First().Id,
                        "Tester", null);
                }
                catch (Exception ex)
                {
                    Log4NetHelper.Log("Send Student Message Failed - ", LogLevel.INFO, "Meetings",
                        meetingsBooked.First().Id,
                        "Tester", ex);
                }
            }
        }
开发者ID:rswetnam,项目名称:GoodBoating,代码行数:43,代码来源:MeetingsServices.cs

示例2: Send_Private_Booking_Invitation

        public static void Send_Private_Booking_Invitation(Meeting meetingBooked, IEmailService emailService,
            ApplicationUserManager userManager)
        {
            var instructor = userManager.FindById(meetingBooked.InstructorId);
            var student = userManager.FindById(meetingBooked.StudentId);
            var subjectLine = "Meeting: " + meetingBooked.Title + " - " + StarterTimeText(meetingBooked);
            var bodyText = GenerateInvitationText(meetingBooked, "", student, instructor);

            var confirmationEmailMessage = BuildEmailMessage(student, subjectLine, bodyText);
            try
            {
                emailService.SendAsync(confirmationEmailMessage);
                Log4NetHelper.Log("Send Message To Student: " + confirmationEmailMessage.To, LogLevel.INFO,
                    "ProcessPrivateMeetingNotifications", meetingBooked.Id,
                    instructor.Email, null);
            }
            catch (Exception ex)
            {
                Log4NetHelper.Log("Send Student Message Failed - ", LogLevel.ERROR, "Meetings", meetingBooked.Id,
                    instructor.Email, ex);
            }
        }
开发者ID:rswetnam,项目名称:GoodBoating,代码行数:22,代码来源:MeetingsServices.cs

示例3: SendMeetingNotifications

        public static void SendMeetingNotifications(Course course, Meeting meetingBooked, IEmailService emailService,
            ApplicationDbContext context, ApplicationUser instructor)
        {
            var enrollments = context.Enrollments.Include("ApplicationUser").Where(e => e.CourseId == course.Id);
            foreach (var enrollment in enrollments)
            {
                try
                {
                    var bodyText = GenerateBodyText(meetingBooked, course.Title, enrollment.ApplicationUser, instructor);

                    var confirmationEmailMessage = BuildEmailMessage(enrollment.ApplicationUser, meetingBooked.Title,
                        bodyText);
                    emailService.SendAsync(confirmationEmailMessage);
                    var logMessage = "Notice of meeting for " + course.Title + " - " + meetingBooked.Title + " sent to " +
                                     enrollment.ApplicationUser.FullName;
                    Log4NetHelper.Log("logMessage", LogLevel.INFO, "MeetingService", 133,
                        meetingBooked.Instructor.FullName, null);
                }
                catch (Exception ex)
                {
                    Log4NetHelper.Log("Send Student Message Failed - ", LogLevel.ERROR, "ManageMeetings", 342, "Tester",
                        ex);
                }
            }
        }
开发者ID:rswetnam,项目名称:GoodBoating,代码行数:25,代码来源:MeetingsServices.cs


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