public async Task Send(SendPrivateEmailInput input)
        {
            var targetUser = await UserManager.FindByNameAsync(input.UserName);

            if (targetUser == null)
            {
                throw new UserFriendlyException("There is no such a user: "******"{0} sent you an email with subject: {1}",
                                  currentUser.UserName,
                                  input.Subject
                                  )
                    );

                await _notificationPublisher.PublishAsync(NotificationNames.YouHaveAnEmail, notificationData, userIds : new[] { targetUser.Id });
            }
        }
Example #2
0
        public async Task Send(SendPrivateEmailInput input)
        {
            var targetUser = await UserManager.FindByNameAsync(input.UserName);

            if (targetUser == null)
            {
                throw new UserFriendlyException("There is no such a user: " + input.UserName);
            }

            await _backgroundJobManager.EnqueueAsync <SendPrivateEmailJob, SendPrivateEmailJobArgs>(
                new SendPrivateEmailJobArgs
            {
                Subject        = input.Subject,
                Body           = input.Body,
                SenderUserId   = AbpSession.GetUserId(),
                TargetTenantId = AbpSession.TenantId,
                TargetUserId   = targetUser.Id
            });
        }