Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <asp:CreateUserWizard ID="userwizard" ContinueDestinationPageUrl="~/secretfiles/secret.aspx" runat="server" >
- <MailDefinition BodyFileName="register.txt" Subject="Registration Confirmation" From="[email protected]" />
- </asp:CreateUserWizard>
- <mailSettings>
- <smtp deliveryMethod="Network" from="[email protected]">
- <network host="smtp.gmail.com" port="25" userName="[email protected]" password="sending emails's password" />
- </smtp>
- </mailSettings>
- ->Use localhost(SMTP)
- ->port=25
- ->authentication not required
- <mailSettings>
- <smtp deliveryMethod="Network" from="[email protected]">
- <network enableSsl="true" host="smtp.gmail.com" port="25" userName="[email protected]" password="sending emails's password" />
- </smtp>
- </mailSettings>
- <mailSettings>
- <smtp deliveryMethod="Network" from="[email protected]">
- <network host="smtp.gmail.com" port="25" userName="[email protected]"
- password="sending emails's password" enableSsl="true" />
- </smtp>
- </mailSettings>
- protected void Button1_Click(object sender, EventArgs e)
- {
- MailMessage mail = new MailMessage();
- MailAddress from = new MailAddress("your mail [email protected]");
- SmtpClient clientobj = new SmtpClient("smtp.gmail.com");
- mail.From = from;
- mail.To.Add(new MailAddress(" to mail [email protected]"));
- mail.Subject = "example gridview";
- mail.Body+="Please check below data <br/><br/>";
- mail.Body += getgridviewdata(gv1);
- mail.IsBodyHtml = true;
- clientobj.Credentials = new System.Net.NetworkCredential("your [email protected]", "your email password");
- clientobj.Port =587;
- clientobj.EnableSsl = true;
- clientobj.Send(mail);
- }
- public string getgridviewdata(GridView gv)
- {
- StringBuilder strBuilder = new StringBuilder();
- StringWriter strWriter = new StringWriter(strBuilder);
- HtmlTextWriter htw = new HtmlTextWriter(strWriter);
- gv.RenderControl(htw);
- return strBuilder.ToString();
- }
- public override void VerifyRenderingInServerForm(Control control)
- {
- /* Verifies that the control is rendered */
- }
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="example.aspx.cs" Inherits="example" EnableEventValidation="false" %>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement