send a part of a form as mail

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agarwalsunitadhn
    New Member
    • Jan 2008
    • 82

    send a part of a form as mail

    helloo..

    I want to send a part of the form as mail. for this i created a division <div> and give it a id so that i can call it for printing purpose...

    but when i send this then the message is sent but instead of sending the part of a page covered under <div> and </div>. It is dending the name of the div i.e. div id....
    Please help me how can i send that as the body of the message
    The code which i will use is:

    <div id="divPrint">

    ...............
    ..............

    </div>
    <asp:Button ID="cmdSendMail " runat="server" Text="Send Mail" OnClick="cmdSen dMail_Click" />

    protected void cmdSendMail_Cli ck(object sender, EventArgs e)
    {
    string contentId = "divPrint";
    try
    {
    MailMessage objEmail=new MailMessage("ma il.domain.com", txtMailTo.Text, "Search Report",content Id.ToString());
    objEmail.Attach ments.Add();
    objEmail.Priori ty=MailPriority .High;
    SmtpClient emailClient = new SmtpClient("mai l.cipla.com");

    emailClient.Sen d(objEmail);
    Response.Write( "Your Email has been sent sucessfully. Thank You");
    }
    catch (Exception exc){
    Response.Write( "Send failure: " + exc.ToString()) ;
    }
    }

    Please help...
  • raravaice
    New Member
    • Feb 2008
    • 4

    #2
    objEmail.BodyFo rmat = MailFormat.Html ;

    Comment

    Working...