public string SendAppEmail(string receiver, string subject, string message, string cc, string bcc, string filename, string sendername)
    {
        string sender   = System.Web.Configuration.WebConfigurationManager.AppSettings["SenderEmail"].ToString();
        string pass     = System.Web.Configuration.WebConfigurationManager.AppSettings["SenderPass"].ToString();
        string hostname = System.Web.Configuration.WebConfigurationManager.AppSettings["MailHost"].ToString();

        ClsAdmin objadmin = new ClsAdmin();

        objadmin.action    = "select";
        objadmin.companyId = "1";
        ds = objadmin.ManageSettings();
        if (ds.Tables[0].Rows.Count > 0)
        {
            if (ds.Tables[0].Rows[0]["SenderEmail"].ToString() != "" && ds.Tables[0].Rows[0]["SenderPass"].ToString() != "")
            {
                sender   = ds.Tables[0].Rows[0]["SenderEmail"].ToString();
                pass     = ds.Tables[0].Rows[0]["SenderPass"].ToString();
                hostname = ds.Tables[0].Rows[0]["MailHost"].ToString();
            }
        }

        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
        string msg = "";

        if (receiver != "")
        {
            string[] strto = receiver.Split(',');

            for (int i = 0; i < strto.Length - 1; i++)
            {
                if (strto[i] != "")
                {
                    mail.To.Add(new MailAddress(strto[i]));
                }
            }
        }

        mail.From    = new MailAddress(sender, sendername);
        mail.Subject = subject;
        mail.Body    = message;
        if (cc != "")
        {
            string[] strcc = cc.Split(',');

            for (int i = 0; i < strcc.Length - 1; i++)
            {
                mail.CC.Add(new MailAddress(strcc[i]));
            }
        }
        if (bcc != "")
        {
            string[] strbcc = bcc.Split(',');

            for (int i = 0; i < strbcc.Length - 1; i++)
            {
                mail.Bcc.Add(new MailAddress(strbcc[i]));
            }
        }
        if (filename != "")
        {
            mail.Attachments.Add(new System.Net.Mail.Attachment(HttpContext.Current.Server.MapPath("webfile/temp/" + filename)));
        }
        mail.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient();

        smtp.Host = hostname;

        smtp.Credentials = new System.Net.NetworkCredential(sender, pass);
        //  smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        //smtp.Port = 25;
        //smtp.EnableSsl = true;
        try
        {
            smtp.Send(mail); msg = "Sent";
        }
        catch (Exception ex)
        {
            msg = ex.ToString();
        }

        return(msg);
    }