コード例 #1
0
        /// <summary>
        /// Boardcast the message to all message accounts by speicifed sender , subject and body
        /// </summary>
        /// <param name="sender">The registered message sender object name.</param>
        /// <param name="subject">The message subject.</param>
        /// <param name="body">The message body.</param>
        /// <param name="from">Identines who send this message .</param>
        public void Boardcast(string sender, string subject, string body, string from)
        {
            if (string.IsNullOrEmpty(sender))
            {
                throw new ArgumentNullException("sender");
            }

            if (string.IsNullOrEmpty(from))
            {
                throw new ArgumentNullException("from");
            }

            if (!Senders.ContainsKey(sender))
            {
                throw new Exception(string.Format("{0} message sender not found.", sender));
            }

            Senders[sender].Boardcast(new Message()
            {
                Body = body, Subject = subject, Creation = DateTime.Now, ContentType = "text/html"
            }, from);
        }
コード例 #2
0
        public void Send(string sender, string from, string to, Message msg)
        {
            if (string.IsNullOrEmpty(sender))
            {
                throw new ArgumentNullException("sender");
            }

            if (string.IsNullOrEmpty(from))
            {
                throw new ArgumentNullException("from");
            }

            if (string.IsNullOrEmpty(to))
            {
                throw new ArgumentNullException("to");
            }

            if (!Senders.ContainsKey(sender))
            {
                throw new Exception(string.Format("{0} message sender not found.", sender));
            }

            Senders[sender].Send(msg, from, to);
        }