/// <summary>
        /// Only used to send internal IT-ish notices
        /// </summary>
        /// <param name="subject">Email subject</param>
        /// <param name="text">Email text</param>
        protected void Notify(string subject, string text)
        {
            bool stamp = true;

            var smtpClient = new DashboardSmtpClient();
            EmailNotification email = new EmailNotification(stamp, smtpClient);

            email.SetFromMailAddress(
                this.FeedConfiguration.EmailFromAddress,
                this.FeedConfiguration.EmailFromName);

            email.SetReceiver(
                this.FeedConfiguration.EmailToAddress,
                this.FeedConfiguration.EmailToName);

            email.Notify(subject, text);
        }
예제 #2
0
        public void SetFromMailAddress()
        {
            // arrange
            bool stamp = true;
            var mockSmtpClient = new DashboardSmtpClient();
            EmailNotification email = new EmailNotification(stamp, mockSmtpClient);

            string fromEmail = this.emailAddress;
            string fromEmailName = "fromEmailName";

            // act
            email.SetFromMailAddress(fromEmail, fromEmailName);

            // assert
            Assert.IsTrue(email.From != null);
            Assert.IsTrue(email.From.Address == fromEmail);
            Assert.IsTrue(email.From.DisplayName == fromEmailName);
        }