Example #1
0
        public void SendOrganizationMemberRemovedNotice(Organization organization, User removedUser)
        {
            if (!organization.EmailAllowed)
            {
                return;
            }

            string subject = $"[{Config.GalleryOwner.DisplayName}] Membership update for organization '{organization.Username}'";

            string body = string.Format(CultureInfo.CurrentCulture, $@"The user '{removedUser.Username}' is no longer a member of organization '{organization.Username}'.

Thanks,
The {Config.GalleryOwner.DisplayName} Team");

            using (var mailMessage = new MailMessage())
            {
                mailMessage.Subject = subject;
                mailMessage.Body    = body;
                mailMessage.From    = Config.GalleryNoReplyAddress;
                mailMessage.ReplyToList.Add(removedUser.ToMailAddress());

                mailMessage.To.Add(organization.ToMailAddress());
                SendMessage(mailMessage);
            }
        }
Example #2
0
        public void SendOrganizationMembershipRequestCancelledNotice(Organization organization, User pendingUser)
        {
            if (!pendingUser.EmailAllowed)
            {
                return;
            }

            string subject = $"[{Config.GalleryOwner.DisplayName}] Membership request for organization '{organization.Username}' cancelled";

            string body = string.Format(CultureInfo.CurrentCulture, $@"The request for you to become a member of '{organization.Username}' has been cancelled.

Thanks,
The {Config.GalleryOwner.DisplayName} Team");

            using (var mailMessage = new MailMessage())
            {
                mailMessage.Subject = subject;
                mailMessage.Body    = body;
                mailMessage.From    = Config.GalleryNoReplyAddress;
                mailMessage.ReplyToList.Add(organization.ToMailAddress());

                mailMessage.To.Add(pendingUser.ToMailAddress());
                SendMessage(mailMessage);
            }
        }
Example #3
0
        public void SendOrganizationMemberUpdatedNotice(Organization organization, Membership membership)
        {
            if (!organization.EmailAllowed)
            {
                return;
            }

            var membershipLevel = membership.IsAdmin ? "an administrator" : "a collaborator";
            var member          = membership.Member;

            string subject = $"[{Config.GalleryOwner.DisplayName}] Membership update for organization '{organization.Username}'";

            string body = string.Format(CultureInfo.CurrentCulture, $@"The user '{member.Username}' is now {membershipLevel} of organization '{organization.Username}'.

Thanks,
The {Config.GalleryOwner.DisplayName} Team");

            using (var mailMessage = new MailMessage())
            {
                mailMessage.Subject = subject;
                mailMessage.Body    = body;
                mailMessage.From    = Config.GalleryNoReplyAddress;
                mailMessage.ReplyToList.Add(member.ToMailAddress());

                mailMessage.To.Add(organization.ToMailAddress());
                SendMessage(mailMessage);
            }
        }
Example #4
0
        public void SendOrganizationMembershipRequest(Organization organization, User newUser, User adminUser, bool isAdmin, string profileUrl, string confirmationUrl, string rejectionUrl)
        {
            if (!newUser.EmailAllowed)
            {
                return;
            }

            var membershipLevel = isAdmin ? "an administrator" : "a collaborator";

            string subject = $"[{Config.GalleryOwner.DisplayName}] Membership request for organization '{organization.Username}'";

            string body = string.Format(CultureInfo.CurrentCulture, $@"The user '{adminUser.Username}' would like you to become {membershipLevel} of their organization, ['{organization.Username}']({profileUrl}).

To learn more about organization roles, [refer to the documentation.](https://go.microsoft.com/fwlink/?linkid=870439)

To accept the request and become {membershipLevel} of '{organization.Username}':

[{confirmationUrl}]({confirmationUrl})

To decline the request:

[{rejectionUrl}]({rejectionUrl})

Thanks,
The {Config.GalleryOwner.DisplayName} Team");

            using (var mailMessage = new MailMessage())
            {
                mailMessage.Subject = subject;
                mailMessage.Body    = body;
                mailMessage.From    = Config.GalleryNoReplyAddress;
                mailMessage.ReplyToList.Add(organization.ToMailAddress());
                mailMessage.ReplyToList.Add(adminUser.ToMailAddress());

                mailMessage.To.Add(newUser.ToMailAddress());
                SendMessage(mailMessage);
            }
        }