コード例 #1
0
        public static void FromConnectionString(this SmtpHealthCheckOptions setup, string cs)
        {
            var c = new SmtpConnectionBuilder(cs);

            setup.Host           = c.Server;
            setup.Port           = c.Port;
            setup.ConnectionType = c.UseSsl ? SmtpConnectionType.TLS : SmtpConnectionType.PLAIN;
            if (c.Username != null)
            {
                setup.LoginWith(c.Username, c.Password);
            }
        }
コード例 #2
0
        public static Configurer WithDefaultTargets(this Configurer @this, string logTableName, string connectionString, string mailFrom, string mailTo,
                                                    string smtpServer, int smtpPort, string smtpUserName, string smtpPassword, bool useSsl,
                                                    bool async = true)
        {
            var smtp = new SmtpConnectionBuilder();

            smtp.Server   = smtpServer;
            smtp.Port     = smtpPort;
            smtp.Username = smtpUserName;
            smtp.Password = smtpPassword;
            smtp.UseSsl   = useSsl;

            return(@this.WithDefaultTargets(logTableName, connectionString, mailFrom, mailTo, smtp.ConnectionString, async));
        }
コード例 #3
0
        public static Configurer WithDefaultTargetsAndRules(this Configurer @this, string logTableName, string connectionString, string mailFrom, string mailTo,
                                                            string smtpServer, int smtpPort, string smtpUserName, string smtpPassword, bool useSsl,
                                                            bool async = true, bool disableMailInDevelop = true)
        {
            var cs = new SmtpConnectionBuilder();

            cs.Server   = smtpServer;
            cs.Port     = smtpPort;
            cs.Username = smtpUserName;
            cs.Password = smtpPassword;
            cs.UseSsl   = useSsl;

            @this.WithArkDefaultTargetsAndRules(logTableName, connectionString, mailFrom, mailTo, cs.ConnectionString, _isProduction(), async);
            if (disableMailInDevelop)
            {
                @this.DisableMailRuleWhenInVisualStudio();
            }
            @this.ThrowInternalExceptionsInVisualStudio();

            return(@this);
        }
コード例 #4
0
ファイル: NlogConfigurer.cs プロジェクト: mpvyard/Ark.Tools
            public Configurer WithMailTarget(string from, string to, string smtpConnectionString, bool async = true)
            {
                var target = _getBasicMailTarget();

                target.From = from;
                target.To   = to;

                var cs = new SmtpConnectionBuilder(smtpConnectionString);

                target.UseSystemNetMailSettings = false;
                target.DeliveryMethod           = System.Net.Mail.SmtpDeliveryMethod.Network;
                target.EnableSsl          = cs.UseSsl;
                target.SmtpAuthentication = SmtpAuthenticationMode.Basic;
                target.SmtpServer         = cs.Server;
                target.SmtpPort           = cs.Port;
                target.SmtpUserName       = cs.Username;
                target.SmtpPassword       = cs.Password;

                _config.AddTarget(MailTarget, async ? _wrapWithAsyncTargetWrapper(target) as Target : target);

                return(this);
            }
コード例 #5
0
            public Configurer WithMailTarget(string from, string to, string smtpConnectionString, bool async = true)
            {
                var cs = new SmtpConnectionBuilder(smtpConnectionString);

                return(this.WithMailTarget(from, to, cs.Server, cs.Port, cs.Username, cs.Password, cs.UseSsl, async));
            }