Beispiel #1
0
        public void ComposeAndQueue(User user, string resetLink)
        {
            if (user == null)
            {
                throw new ArgumentNullException("user");
            }
            if (String.IsNullOrEmpty(resetLink))
            {
                throw new ArgumentException("resetLink");
            }
            var settings = _settingsManager.Current;
            var body     = String.Format(Resources.ForgotPasswordEmail
                                         , settings.ForumTitle, resetLink, settings.MailSignature, Environment.NewLine);
            var message = new QueuedEmailMessage
            {
                Body      = body,
                Subject   = String.Format(Resources.ForgotPasswordSubject, settings.ForumTitle),
                ToEmail   = user.Email,
                ToName    = user.Name,
                FromEmail = settings.MailerAddress,
                FromName  = settings.ForumTitle,
                QueueTime = DateTime.UtcNow
            };

            _queuedQueuedEmailRepo.CreateMessage(message);
        }
Beispiel #2
0
        public void CreateAndQueueEmail(QueuedEmailMessage queuedEmailMessage)
        {
            var id       = _queuedEmailMessageRepository.CreateMessage(queuedEmailMessage);
            var tenantID = _tenantService.GetTenant();
            var payload  = new EmailQueuePayload {
                MessageID = id, EmailQueuePayloadType = EmailQueuePayloadType.FullMessage, TenantID = tenantID
            };

            _emailQueueRepository.Enqueue(payload);
        }
Beispiel #3
0
		public void ComposeAndQueue(Topic topic, User user, string topicLink, string unsubscribeLink)
		{
			var settings = _settingsManager.Current;
			var body = String.Format(Resources.SubscribedEmailBody, settings.ForumTitle, topic.Title, topicLink, unsubscribeLink, settings.MailSignature, Environment.NewLine);
			var message = new QueuedEmailMessage
			              	{
			              		Body = body, 
								Subject =String.Format(Resources.SubscribedEmailSubject, topic.Title), 
								ToEmail = user.Email, 
								ToName = user.Name, 
								FromEmail = settings.MailerAddress, 
								FromName = settings.ForumTitle, 
								QueueTime = DateTime.UtcNow
			              	};
			_queuedQueuedEmailRepo.CreateMessage(message);
		}
Beispiel #4
0
        public void ComposeAndQueue(User user, string subject, string body, string htmlBody, string unsubscribeLink)
        {
            var settings = _settingsManager.Current;
            var ps       = String.Format("{1}{1}Unsubscribe: {0}", unsubscribeLink, Environment.NewLine);
            var message  = new QueuedEmailMessage
            {
                Body      = body + ps,
                Subject   = subject,
                ToEmail   = user.Email,
                ToName    = user.Name,
                FromEmail = settings.MailerAddress,
                FromName  = settings.ForumTitle,
                QueueTime = DateTime.UtcNow
            };

            if (!String.IsNullOrWhiteSpace(htmlBody))
            {
                message.HtmlBody = String.Format("{0}<p>Unsubscribe: <a href=\"{1}\">{1}</a></p>", htmlBody, unsubscribeLink);
            }
            _queuedQueuedEmailRepo.CreateMessage(message);
        }
Beispiel #5
0
        public void ComposeAndQueue(User toUser, User fromUser, string ip, string subject, string text)
        {
            if (!IsUserEmailable(toUser))
            {
                throw new Exception("Can't send e-mail to a user who hides their details.");
            }

            if (toUser == null)
            {
                throw new ArgumentNullException("toUser");
            }
            if (fromUser == null)
            {
                throw new ArgumentNullException("fromUser");
            }
            var settings = _settingsManager.Current;
            var body     = String.Format(@"E-mail sent via {0} (senders's IP: {1}):

{2}

______________________
{3}"
                                         , settings.ForumTitle, ip, text, settings.MailSignature);
            var message = new QueuedEmailMessage
            {
                Body      = body,
                Subject   = subject,
                ToEmail   = toUser.Email,
                ToName    = toUser.Name,
                FromEmail = fromUser.Email,
                FromName  = fromUser.Name,
                QueueTime = DateTime.UtcNow
            };

            _queuedQueuedEmailRepo.CreateMessage(message);
        }