Ejemplo n.º 1
0
        private void SendInviteRequestMail(IEnumerable<InviteRequestItem> invitedPeople, string communityName)
        {
            try
            {
                foreach (var item in invitedPeople)
                {
                    // Update the body to include the token.
                    var joinCommunityLink = string.Format(CultureInfo.InvariantCulture, "{0}Community/Join/{1}/{2}", HttpContext.Request.Url.GetServerLink(), item.CommunityID, item.InviteRequestToken);

                    var notifyInviteRequest = new NotifyInviteRequest()
                    {
                        EmailId = item.EmailIdList.ElementAt(0),
                        CommunityID = item.CommunityID,
                        CommunityName = communityName,
                        CommunityLink = string.Format(CultureInfo.InvariantCulture, "{0}Community/Index/{1}", HttpContext.Request.Url.GetServerLink(), item.CommunityID),
                        Subject = item.Subject,
                        Body = item.Body,
                        InviteLink = joinCommunityLink
                    };

                    // Send Mail for each invited people separately since the token is going to be unique for each user.
                    _notificationService.NotifyCommunityInviteRequest(notifyInviteRequest);
                }
            }
            catch (Exception)
            {
                // Ignore all exceptions.
            }
        }
Ejemplo n.º 2
0
        public static EmailRequest UpdateFrom(this EmailRequest thisObject, NotifyInviteRequest request)
        {
            if (thisObject == null)
            {
                thisObject = new EmailRequest();
            }

            thisObject.Recipients.Add(new MailAddress(request.EmailId));

            thisObject.IsHtml = true;

            // Update the body and the subject.
            thisObject.Subject = request.Subject;

            var replacements = new Dictionary<string, string>
            {
                { "@@Title@@", HttpUtility.UrlDecode(request.Subject) },
                { "@@Body@@", HttpUtility.UrlDecode(request.Body) },
                { "@@EntityName@@", HttpUtility.UrlDecode(request.CommunityName) },
                { "@@EntityLink@@", HttpUtility.UrlDecode(request.CommunityLink) },
                { "@@InviteLink@@", HttpUtility.UrlDecode(request.InviteLink) },
                { "@@ContactUsLink@@", string.Format(CultureInfo.CurrentUICulture, "mailto:{0}", Constants.MicrosoftEmail) },
                { "@@ForumsLink@@", Constants.WWTForumUrl }
            };

            thisObject.MessageBody = FormatMailBodyUsingTemplate("communityinviterequest.html", replacements);

            return thisObject;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Notify the user about the invitation sent for joining a community.
 /// </summary>
 /// <param name="notification">Invitation request details</param>
 public void NotifyCommunityInviteRequest(NotifyInviteRequest notification)
 {
     SendMail(notification);
 }