Пример #1
0
    public void SendMail(string reason, string fromdate, string todate)
    {
        string SmtpServer;
        int    SmtpPort;
        string MailFrom;
        string DisplayNameFrom;
        string FromPassword;
        string MailTo;
        string DisplayNameTo;
        string MailCc        = "";
        string DisplayNameCc = "";
        string MailBcc       = "";
        string Subject       = "Leave Request";
        string Attachment    = "";
        string MailCc2       = "";
        string MailCc3       = "";

        string name = Session["firstname"].ToString() + " " + Session["lastname"].ToString();

        string leavedate = "Leave Date" + " : " + "From Date: " + fromdate + "   To Date: " + todate;
        string MailText  = "Hi Team," + "<br/><br/>" + leavedate + "<br/>" + "Reason:  " + reason + "<br/><br/>" + "Thank you," + "<br/>" + name;

        // MailCc2 = "*****@*****.**";
        //MailCc3 = "*****@*****.**";

        SmtpServer = "smtp.gmail.com";
        SmtpPort   = 587;
        // MailFrom = "*****@*****.**";
        MailFrom        = "*****@*****.**";
        DisplayNameFrom = "Dinoosys Technologies";
        // FromPassword = "******";
        FromPassword = "******";
        //MailTo = Session["Email"].ToString();
        MailTo = "*****@*****.**";

        DisplayNameTo = name;


        if (CommanClass.SendEmail(SmtpServer, SmtpPort, MailFrom, DisplayNameFrom, FromPassword, MailTo, DisplayNameTo, MailCc, MailCc2, MailCc3, DisplayNameCc, MailBcc, Subject, MailText, Attachment))
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message alert", "alert('Mail send successfully !!');", true);
        }

        else
        {
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message alert", "alert('Mail was not send please contact your admin!!');", true);
        }
    }
Пример #2
0
    private bool MailSending(string EmpID, string Password, string MailId)
    {
        try
        {
            string SmtpServer;
            int    SmtpPort;
            string MailFrom;
            string DisplayNameFrom;
            string FromPassword = "";
            string MailTo;
            string DisplayNameTo;
            string MailCc        = "*****@*****.**";
            string DisplayNameCc = "";
            string MailBcc       = "";
            string Subject       = "Invitation";
            string Attachment    = "";
            string MailCc2       = "";
            string MailCc3       = "";


            //string name = Session["firstname"].ToString() + " " + Session["lastname"].ToString();

            // string leavedate = "Leave Date" + " : " + "From Date: " + fromdate + "&nbsp;&nbsp; To Date: " + todate;
            string MailText = "URL: " + "http://hrmsdev.dinoosystech.com/login.aspx " + "<br/>" + "LoginID:  " + EmpID + "<br/>" + "Password: "******"<br/> " + "To change password please visit this URL" + "http://hrmsdev.dinoosystech.com/admin/ChangePassword.aspx";

            // MailCc2 = "*****@*****.**";


            SmtpServer = "smtp.gmail.com";
            SmtpPort   = 25;
            MailFrom   = "*****@*****.**";
            // MailFrom = "*****@*****.**";
            DisplayNameFrom = "Dinoosys Technologies";
            FromPassword    = "******";
            //FromPassword = "******";
            //MailTo = Session["Email"].ToString();
            MailTo = MailId;


            DisplayNameTo = "";


            if (CommanClass.SendEmail(SmtpServer, SmtpPort, MailFrom, DisplayNameFrom, FromPassword, MailTo, DisplayNameTo, MailCc, MailCc2, MailCc3, DisplayNameCc, MailBcc, Subject, MailText, Attachment))
            {
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message alert", "alert('Mail send successfully !!');", true);
                // ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage('Mail send successfully !!');", true);
                issuccess = true;
            }



            //ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "alertMessage();", true);


            else
            {
                issuccess = false;
                // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "message alert", "alert('Mail was not send please contact your admin!!');", true);
            }
            return(issuccess);
        }
        catch (Exception)
        {
            throw;
        }
    }