Example #1
0
        /// <summary>
        /// Initializes a new instance of <see cref="EmailTraceListener"/> with a toaddress, fromaddress,
        /// subjectlinestarter, subjectlinender, smtpserver, smtpport and authentication information.
        /// </summary>
        /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
        /// <param name="fromAddress">Represents from whom the email is sent.</param>
        /// <param name="subjectLineStarter">Starting text for the subject line.</param>
        /// <param name="subjectLineEnder">Ending text for the subject line.</param>
        /// <param name="smtpServer">The name of the SMTP server.</param>
        /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
        /// <param name="authenticationMode">Authentication style to use when connecting to SMTP server.</param>
        /// <param name="userName">User name to use for authentication if using username/password authentication.</param>
        /// <param name="password">Password to use for authentication if using username/password authentication.</param>
        /// <param name="useSSL">Use SSL to connect to mail server if true, regular socket if false.</param>
        public EmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort,
                                  EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
        {
            Guard.ArgumentNotNullOrEmpty(toAddress, "toAddress");
            Guard.ArgumentNotNullOrEmpty(fromAddress, "fromAddress");
            Guard.ArgumentNotNullOrEmpty(subjectLineStarter, "subjectLineStarter");
            Guard.ArgumentNotNullOrEmpty(subjectLineEnder, "subjectLineEnder");
            Guard.ArgumentNotNullOrEmpty(smtpServer, "smtpServer");

            if (authenticationMode == EmailAuthenticationMode.UserNameAndPassword)
            {
                Guard.ArgumentNotNullOrEmpty(userName, "userName");
            }

            this.toAddress          = toAddress;
            this.fromAddress        = fromAddress;
            this.subjectLineStarter = subjectLineStarter;
            this.subjectLineEnder   = subjectLineEnder;
            this.smtpServer         = smtpServer;
            this.smtpPort           = smtpPort;
            this.authenticationMode = authenticationMode;
            this.userName           = userName;
            this.password           = password;
            this.useSSL             = useSSL;
        }
        /// <summary>
        /// Initializes a new instance of <see cref="HtmlEmailTraceListener"/> with a toaddress, fromaddress,
        /// subjectlinestarter, subjectlinender, smtpserver, smtpport, and a formatter
        /// a <see cref="ILogFormatter"/>.
        /// </summary>
        /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
        /// <param name="fromAddress">Represents from whom the email is sent.</param>
        /// <param name="subjectLineStarter">Starting text for the subject line.</param>
        /// <param name="subjectLineEnder">Ending text for the subject line.</param>
        /// <param name="smtpServer">The name of the SMTP server.</param>
        /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
        /// <param name="formatter">The Formatter <see cref="ILogFormatter"/> which determines how the
        /// email message should be formatted</param>
        /// <param name="authenticationMode">Authentication style to use when connecting to SMTP server.</param>
        /// <param name="userName">User name to use for authentication if using username/password authentication.</param>
        /// <param name="password">Password to use for authentication if using username/password authentication.</param>
        /// <param name="useSSL">Use SSL to connect to mail server if true, regular socket if false.</param>

        public HtmlEmailTraceListener(
            string toAddress,
            string fromAddress,
            string subjectLineStarter,
            string subjectLineEnder,
            string smtpServer,
            int smtpPort,
            ILogFormatter formatter,
            EmailAuthenticationMode authenticationMode,
            string userName,
            string password,
            bool useSSL)
            : base(formatter)
        {
            this.toAddress          = toAddress;
            this.fromAddress        = fromAddress;
            this.subjectLineStarter = subjectLineStarter;
            this.subjectLineEnder   = subjectLineEnder;
            this.smtpServer         = smtpServer;
            this.smtpPort           = smtpPort;
            this.authenticationMode = authenticationMode;
            this.userName           = userName;
            this.password           = password;
            this.useSSL             = useSSL;
        }
 public CachedEmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, ILogFormatter formatter, EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL, double emailCacheDuration)
     : base(toAddress, fromAddress, subjectLineStarter, subjectLineEnder, smtpServer, smtpPort, formatter, authenticationMode, userName, password, useSSL)
 {
     this.emailCacheDuration = emailCacheDuration;
     if (emailCacheDuration > 0)
     {
         // Email cache duration is in hours
         this.cacheItemPolicyFactory = new AbsoluteCacheItemPolicyFactory(Convert.ToInt32(emailCacheDuration * 3600));
     }
 }
 /// <summary>
 /// Initializes a <see cref="EmailMessage"/> with the raw data to create and email, the logentry, and the formatter
 /// </summary>
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="logEntry">The LogEntry <see cref="LogEntry"/> to send via email.</param>
 /// <param name="formatter">The Formatter <see cref="ILogFormatter"/> which determines how the
 /// email message should be formatted</param>
 /// <param name="authenticationMode">Authenticate mode to use when connecting to SMTP server.</param>
 /// <param name="userName">User name to send to SMTP server if using username/password authentication.</param>
 /// <param name="password">Password to send to SMTP server if using username/password authentication.</param>
 /// <param name="useSSL">Use SSL to connect to STMP server - if true, yes, if false, no.</param>
 public EmailMessage(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, LogEntry logEntry, ILogFormatter formatter,
                     EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
 {
     this.configurationData = new EmailTraceListenerData(toAddress, fromAddress, subjectLineStarter,
                                                         subjectLineEnder, smtpServer, smtpPort, string.Empty)
     {
         AuthenticationMode = authenticationMode,
         UserName           = userName,
         Password           = password,
         UseSSL             = useSSL
     };
     this.logEntry  = logEntry;
     this.formatter = formatter;
 }
 /// <summary>
 /// Initializes a <see cref="EmailMessage"/> with the raw data to create and email, the logentry, and the formatter 
 /// </summary>
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="logEntry">The LogEntry <see cref="LogEntry"/> to send via email.</param>
 /// <param name="formatter">The Formatter <see cref="ILogFormatter"/> which determines how the 
 /// email message should be formatted</param>
 /// <param name="authenticationMode">Authenticate mode to use when connecting to SMTP server.</param>
 /// <param name="userName">User name to send to SMTP server if using username/password authentication.</param>
 /// <param name="password">Password to send to SMTP server if using username/password authentication.</param>
 /// <param name="useSSL">Use SSL to connect to STMP server - if true, yes, if false, no.</param>
 public EmailMessage(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, LogEntry logEntry, ILogFormatter formatter,
     EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
 {
     this.configurationData = new EmailTraceListenerData(toAddress, fromAddress, subjectLineStarter,
                                                         subjectLineEnder, smtpServer, smtpPort, string.Empty)
                                  {
                                      AuthenticationMode = authenticationMode,
                                      UserName = userName,
                                      Password = password,
                                      UseSSL = useSSL
                                  };
     this.logEntry = logEntry;
     this.formatter = formatter;
 }
Example #6
0
 /// <summary>
 /// Initializes a <see cref="EmailTraceListenerData"/> with a toaddress,
 /// fromaddress, subjectLineStarter, subjectLineEnder, smtpServer, a formatter name, trace options
 /// and authentication information.
 /// </summary>
 /// <param name="name">The name of this listener</param>
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="formatterName">The name of the Formatter <see cref="ILogFormatter"/> which determines how the
 ///email message should be formatted</param>
 /// <param name="traceOutputOptions">The trace options.</param>
 /// <param name="filter">The filter to apply.</param>
 /// <param name="authenticationMode">Authenticate mode to use.</param>
 /// <param name="userName">User name to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="password">Password to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="useSSL">Connect to the server using SSL?</param>
 public CachedEmailTraceListenerData(string name,
                                     string toAddress, string fromAddress,
                                     string subjectLineStarter, string subjectLineEnder,
                                     string smtpServer, int smtpPort,
                                     string formatterName, TraceOptions traceOutputOptions, SourceLevels filter,
                                     EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
     : base(name,
            toAddress, fromAddress,
            subjectLineStarter, subjectLineEnder,
            smtpServer, smtpPort,
            formatterName, traceOutputOptions, filter,
            authenticationMode, userName, password, useSSL)
 {
     this.ListenerDataType = typeof(CachedEmailTraceListenerData);
     this.Type             = typeof(CachedEmailTraceListener);
 }
 /// <summary>
 /// Initializes a <see cref="EmailTraceListenerData"/> with a toaddress,
 /// fromaddress, subjectLineStarter, subjectLineEnder, smtpServer, a formatter name, trace options
 /// and authentication information.
 /// </summary>
 /// <param name="name">The name of this listener</param>
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="formatterName">The name of the Formatter <see cref="ILogFormatter"/> which determines how the
 ///email message should be formatted</param>
 /// <param name="traceOutputOptions">The trace options.</param>
 /// <param name="filter">The filter to apply.</param>
 /// <param name="authenticationMode">Authenticate mode to use.</param>
 /// <param name="userName">User name to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="password">Password to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="useSSL">Connect to the server using SSL?</param>
 public EmailTraceListenerData(string name,
                               string toAddress, string fromAddress,
                               string subjectLineStarter, string subjectLineEnder,
                               string smtpServer, int smtpPort,
                               string formatterName, TraceOptions traceOutputOptions, SourceLevels filter,
                               EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
     : base(name, typeof(EmailTraceListener), traceOutputOptions, filter)
 {
     this.ToAddress          = toAddress;
     this.FromAddress        = fromAddress;
     this.SubjectLineStarter = subjectLineStarter;
     this.SubjectLineEnder   = subjectLineEnder;
     this.SmtpServer         = smtpServer;
     this.SmtpPort           = smtpPort;
     this.Formatter          = formatterName;
     this.AuthenticationMode = authenticationMode;
     this.UserName           = userName;
     this.Password           = password;
     this.UseSSL             = useSSL;
 }
 public CachedEmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
     : base(toAddress, fromAddress, subjectLineStarter, subjectLineEnder, smtpServer, smtpPort, authenticationMode, userName, password, useSSL)
 {
 }
 /// <summary>
 /// Initializes a <see cref="EmailTraceListenerData"/> with a toaddress, 
 /// fromaddress, subjectLineStarter, subjectLineEnder, smtpServer, a formatter name, trace options
 /// and authentication information.
 /// </summary>
 /// <param name="name">The name of this listener</param>        
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="formatterName">The name of the Formatter <see cref="ILogFormatter"/> which determines how the
 ///email message should be formatted</param>
 /// <param name="traceOutputOptions">The trace options.</param>
 /// <param name="filter">The filter to apply.</param>
 /// <param name="authenticationMode">Authenticate mode to use.</param>
 /// <param name="userName">User name to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="password">Password to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="useSSL">Connect to the server using SSL?</param>
 public EmailTraceListenerData(string name, 
     string toAddress, string fromAddress, 
     string subjectLineStarter, string subjectLineEnder, 
     string smtpServer, int smtpPort, 
     string formatterName, TraceOptions traceOutputOptions, SourceLevels filter,
     EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
     : base(name, typeof(EmailTraceListener), traceOutputOptions, filter)
 {
     this.ToAddress = toAddress;
     this.FromAddress = fromAddress;
     this.SubjectLineStarter = subjectLineStarter;
     this.SubjectLineEnder = subjectLineEnder;
     this.SmtpServer = smtpServer;
     this.SmtpPort = smtpPort;
     this.Formatter = formatterName;
     this.AuthenticationMode = authenticationMode;
     this.UserName = userName;
     this.Password = password;
     this.UseSSL = useSSL;
 }
 /// <summary>
 /// Initializes a new instance of <see cref="EmailTraceListener"/> with a toaddress, fromaddress, 
 /// subjectlinestarter, subjectlinender, smtpserver, smtpport and authentication information.
 /// </summary>
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="authenticationMode">Authentication style to use when connecting to SMTP server.</param>
 /// <param name="userName">User name to use for authentication if using username/password authentication.</param>
 /// <param name="password">Password to use for authentication if using username/password authentication.</param>
 /// <param name="useSSL">Use SSL to connect to mail server if true, regular socket if false.</param>
 public EmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort,
     EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
 {
     this.toAddress = toAddress;
     this.fromAddress = fromAddress;
     this.subjectLineStarter = subjectLineStarter;
     this.subjectLineEnder = subjectLineEnder;
     this.smtpServer = smtpServer;
     this.smtpPort = smtpPort;
     this.authenticationMode = authenticationMode;
     this.userName = userName;
     this.password = password;
     this.useSSL = useSSL;
 }
Example #11
0
 public CachedEmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
     : base(toAddress, fromAddress, subjectLineStarter, subjectLineEnder, smtpServer, smtpPort, authenticationMode, userName, password, useSSL)
 {
 }
Example #12
0
 public CachedEmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort, ILogFormatter formatter, EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL, double emailCacheDuration)
     : base(toAddress, fromAddress, subjectLineStarter, subjectLineEnder, smtpServer, smtpPort, formatter, authenticationMode, userName, password, useSSL)
 {
     this.emailCacheDuration = emailCacheDuration;
     if (emailCacheDuration > 0)
     {
         // Email cache duration is in hours
         this.cacheItemPolicyFactory = new AbsoluteCacheItemPolicyFactory(Convert.ToInt32(emailCacheDuration * 3600));
     }
 }
        /// <summary>
        /// Initializes a new instance of <see cref="EmailTraceListener"/> with a toaddress, fromaddress, 
        /// subjectlinestarter, subjectlinender, smtpserver, smtpport and authentication information.
        /// </summary>
        /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
        /// <param name="fromAddress">Represents from whom the email is sent.</param>
        /// <param name="subjectLineStarter">Starting text for the subject line.</param>
        /// <param name="subjectLineEnder">Ending text for the subject line.</param>
        /// <param name="smtpServer">The name of the SMTP server.</param>
        /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
        /// <param name="authenticationMode">Authentication style to use when connecting to SMTP server.</param>
        /// <param name="userName">User name to use for authentication if using username/password authentication.</param>
        /// <param name="password">Password to use for authentication if using username/password authentication.</param>
        /// <param name="useSSL">Use SSL to connect to mail server if true, regular socket if false.</param>
        public EmailTraceListener(string toAddress, string fromAddress, string subjectLineStarter, string subjectLineEnder, string smtpServer, int smtpPort,
            EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
        {
            Guard.ArgumentNotNullOrEmpty(toAddress, "toAddress");
            Guard.ArgumentNotNullOrEmpty(fromAddress, "fromAddress");
            Guard.ArgumentNotNullOrEmpty(subjectLineStarter, "subjectLineStarter");
            Guard.ArgumentNotNullOrEmpty(subjectLineEnder, "subjectLineEnder");
            Guard.ArgumentNotNullOrEmpty(smtpServer, "smtpServer");

            if (authenticationMode == EmailAuthenticationMode.UserNameAndPassword)
            {
                Guard.ArgumentNotNullOrEmpty(userName, "userName");
            }

            this.toAddress = toAddress;
            this.fromAddress = fromAddress;
            this.subjectLineStarter = subjectLineStarter;
            this.subjectLineEnder = subjectLineEnder;
            this.smtpServer = smtpServer;
            this.smtpPort = smtpPort;
            this.authenticationMode = authenticationMode;
            this.userName = userName;
            this.password = password;
            this.useSSL = useSSL;
        }
 /// <summary>
 /// Initializes a <see cref="EmailTraceListenerData"/> with a toaddress, 
 /// fromaddress, subjectLineStarter, subjectLineEnder, smtpServer, a formatter name, trace options
 /// and authentication information.
 /// </summary>
 /// <param name="name">The name of this listener</param>        
 /// <param name="toAddress">A semicolon delimited string the represents to whom the email should be sent.</param>
 /// <param name="fromAddress">Represents from whom the email is sent.</param>
 /// <param name="subjectLineStarter">Starting text for the subject line.</param>
 /// <param name="subjectLineEnder">Ending text for the subject line.</param>
 /// <param name="smtpServer">The name of the SMTP server.</param>
 /// <param name="smtpPort">The port on the SMTP server to use for sending the email.</param>
 /// <param name="formatterName">The name of the Formatter <see cref="ILogFormatter"/> which determines how the
 ///email message should be formatted</param>
 /// <param name="traceOutputOptions">The trace options.</param>
 /// <param name="filter">The filter to apply.</param>
 /// <param name="authenticationMode">Authenticate mode to use.</param>
 /// <param name="userName">User name to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="password">Password to pass to the server if using <see cref="EmailAuthenticationMode.UserNameAndPassword"/>.</param>
 /// <param name="useSSL">Connect to the server using SSL?</param>
 public CachedEmailTraceListenerData(string name, 
     string toAddress, string fromAddress, 
     string subjectLineStarter, string subjectLineEnder, 
     string smtpServer, int smtpPort, 
     string formatterName, TraceOptions traceOutputOptions, SourceLevels filter,
     EmailAuthenticationMode authenticationMode, string userName, string password, bool useSSL)
     : base(name, 
     toAddress, fromAddress, 
     subjectLineStarter, subjectLineEnder, 
     smtpServer, smtpPort, 
     formatterName, traceOutputOptions, filter,
     authenticationMode, userName, password, useSSL)
 {
     this.ListenerDataType = typeof(CachedEmailTraceListenerData);
     this.Type = typeof(CachedEmailTraceListener);
 }