Пример #1
0
    private bool SendEmail(string mail, string strpass)
    {
        string bodyHTML = string.Empty;
        bool   isSent   = false;

        try
        {
            bodyHTML  = "<p>Dear SALKI VALVE,</p>";
            bodyHTML += "<p>We've received a request to reset your password.</p>";
            bodyHTML += "<p>PFB Reset Password for " + mail + ".</p>";
            bodyHTML += @" <html><table width = '300' cellpadding = '0' cellspacing = '0' align = 'left' border = '1' >"
                        + "<tr>"
                        + "<td align ='center'>"
                        + "<tr>"
                        + " <td> Email ID </td>"
                        + "<td> Password </td>"
                        + " </tr>"
                        + "<tr>"
                        + "<td> " + mail + " </td>"
                        + "<td> " + strpass + " </td>"
                        + " </tr>"
                        + " </td>"
                        + " </tr>"
                        + " </table>"
                        + " </html>";
            CoreApp.SendMail snd = new CoreApp.SendMail();
            //snd.From = stremail;
            snd.Sub  = "Forgot Password";
            snd.Body = bodyHTML;
            snd.SendEMail();

            //[email protected]
            isSent = snd.IsMail;
            return(isSent);
        }
        catch (Exception ex)
        {
            ShowMessageBox(ex.ToString(), false);
            return(isSent);
        }
    }
Пример #2
0
    protected void SendEMail(object sender, EventArgs e)
    {
        try
        {
            // If page not Refreshed
            if (Session["update"].ToString() == ViewState["update"].ToString())
            {
                string strname     = Request["name"].ToString();
                string strmobileno = Request["mobileno"].ToString();
                string stremail    = Request["email"].ToString();
                string strsubject  = Request["subject"].ToString();
                string strmessage  = Request["message"].ToString();
                string bodyHTML    = string.Empty;
                bool   isSent      = false;

                bodyHTML  = "<p>Dear SALKI VALVE,</p>";
                bodyHTML += "<p>" + strname + " is interested in your business.</p>";
                bodyHTML += "<p>PFB Message From " + strname + ".</p> <p>" + strmessage + " </p>";
                bodyHTML += "<p>PFB Contact Details.</p>";
                bodyHTML += @" <html><table width = '300' cellpadding = '0' cellspacing = '0' align = 'left' border = '1' >"
                            + "<tr>"
                            + "<td align ='center'>"
                            + "<tr>"
                            + "<td> Mobile No. </td>"
                            + " <td> Email ID </td>"
                            + " </tr>"
                            + "<tr>"
                            + "<td> " + strmobileno + " </td>"
                            + "<td> " + stremail + " </td>"
                            + " </tr>"
                            + " </td>"
                            + " </tr>"
                            + " </table>"
                            + " </html>";
                CoreApp.SendMail snd = new CoreApp.SendMail();
                //snd.From = stremail;
                snd.To   = "*****@*****.**";
                snd.Sub  = strsubject;
                snd.Body = bodyHTML;
                snd.SendEMail();

                Session["update"] = Server.UrlEncode(System.DateTime.Now.ToString());

                //[email protected]
                isSent = snd.IsMail;
                NavigationURL.Value = "Contactus.aspx";
                if (isSent)
                {
                    ShowMessageBox("Email have been sent successfuly.");
                }
                else
                {
                    ShowMessageBox("Unable to Send Email", false);
                }
            }
        }
        catch (Exception ex)
        {
            ShowMessageBox(ex.Message, false);
        }
    }