Exemple #1
0
    private static SysProfile GetClient(string name, ref string error)
    {
        SysProfile p;
        var        wrapper = new EncryptSupport.Simple3Des(SecretWord);

// Built in profile called ssl
        if (name == "ssl")
        {
            p = new SysProfile
            {
                BuilInName = name,
                Client     = new SmtpClient
                {
                    UseDefaultCredentials = false,
                    Port        = 587,
                    Host        = "smtp.gmail.com",
                    EnableSsl   = true,
                    Credentials = new NetworkCredential(wrapper.DecryptData("DE5ZET4hY95fZ7JadaxKqchFuvrR3p12vlY="),
                                                        wrapper.DecryptData("ovkrtZ/="))
                }
            };

// encrypted credential
        }

// Built in profile called simple
        else if (name == "simple")
        {
            p = new SysProfile
            {
                BuilInName = name,
                Client     = new SmtpClient
                {
                    UseDefaultCredentials = true,
                    Port      = 25,
                    Host      = "mail.iskon.hr",
                    EnableSsl = false
                }
            };

// encrypted credential
            // p.client.Credentials = new NetworkCredential(wrapper.DecryptData("El+=="), wrapper.DecryptData("=="));
        }
        else
        {
            // determine profile by quering the database
            var listOfParams = new SqlParameter[1];
            var pName        = new SqlParameter("name", name)
            {
                Size      = 20,
                SqlDbType = System.Data.SqlDbType.Char
            };
            listOfParams[0] = pName;
            p = DataAccess.GetProfile(listOfParams, wrapper, ref error);
        }

        return(p);
    }
Exemple #2
0
    private static SysProfile GetClient(string name, ref string error)
    {
        SysProfile p = null;

        EncryptSupport.Simple3Des wrapper = new EncryptSupport.Simple3Des(SECRET_WORD);
        //Built in profile called ssl
        if (name == "ssl")
        {
            p            = new SysProfile();
            p.builInName = name;
            p.client     = new SmtpClient();
            p.client.UseDefaultCredentials = false;
            p.client.Port      = 587;
            p.client.Host      = "smtp.gmail.com";
            p.client.EnableSsl = true;
            // encrypted credential
            p.client.Credentials = new NetworkCredential(wrapper.DecryptData("DE5ZET4hY95fZ7JadaxKqchFuvrR3p12vlY="), wrapper.DecryptData("ovkrtZ/="));
        }
        //Built in profile called simple
        else if (name == "simple")
        {
            p            = new SysProfile();
            p.builInName = name;
            p.client     = new SmtpClient();
            p.client.UseDefaultCredentials = false;
            p.client.Port      = 25;
            p.client.Host      = "mail.iskon.hr";
            p.client.EnableSsl = false;
            // encrypted credential
            p.client.Credentials = new NetworkCredential(wrapper.DecryptData("El+=="), wrapper.DecryptData("=="));
        }
        else
        {
            //determine profile by quering the database
            SqlParameter[] listOfParams = new SqlParameter[1];
            SqlParameter   pName        = new SqlParameter("name", name);
            pName.Size      = 20;
            pName.SqlDbType = System.Data.SqlDbType.Char;
            listOfParams[0] = pName;
            p = DataAccess.GetProfile(listOfParams, wrapper, ref error);
        }
        return(p);
    }