a form to email

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • newer

    a form to email

    i want to know how can i get the form information with mailbody ? am i doing
    wrong with "objMail.Bo dy =......" ? please help!
    here it is :
    <%@ Import Namespace="Syst em.Web.Mail" %>
    <Script Language="VB" Runat="Server">
    Sub Send(sender As Object, e As EventArgs)
    Dim objMail As New MailMessage()
    objMail.From = FromWho.Text & "<" & FromMail.Text & ">"
    objMail.To = "mail@address.c om"
    objMail.BodyFor mat = MailFormat.Text
    objMail.BodyEnc oding = Encoding.ASCII
    objMail.Subject = "Order"
    objMail.Body =request.Form(" tform""'FromWho ','FromMail','t el','address'")

    SmtpMail.SmtpSe rver = "mail.server.co m"
    SmtpMail.Send(o bjMail)
    Response.Redire ct("abc.htm")
    End Sub
    </Script>
    <Html>
    <Head>
    <Title>Tester </Title>
    </Head>
    <Body>

    <Form Runat="Server" id=tform>
    Namer : <Asp:TextBox Runat="Server" Id="FromWho" Columns="7" /> <br>
    Email Address : <Asp:TextBox Runat="Server" Id="FromMail" Columns="20" /><br>
    Tel : <Asp:TextBox Runat="Server" Id="tel" Columns="8" /><br>
    Address : <Asp:TextBox Runat="Server" Id="address" Columns="20" /><br>


    <Asp:Button Runat="Server" OnClick="Send" text="Send" />
    </Center>
    </Form>


    </Body>
    </Html>
  • Ross Presser

    #2
    Re: a form to email

    On Fri, 17 Sep 2004 10:33:03 -0700, newer wrote:[color=blue]
    > i want to know how can i get the form information with mailbody ? am i doing
    > wrong with "objMail.Bo dy =......" ? please help![/color]
    ....[color=blue]
    > objMail.Body =request.Form(" tform""'FromWho ','FromMail','t el','address'")[/color]

    request.Form doesn't work that way... try

    objMail.Body = FromWho.Text & vbCrLf & FromMail.Text & vbCrLf _
    & tel.Text & vbCrLf & address.Text

    Comment

    • newer

      #3
      RE: a form to email

      Ross Presser,
      It works now ! Thank you so much !

      "newer" wrote:
      [color=blue]
      > i want to know how can i get the form information with mailbody ? am i doing
      > wrong with "objMail.Bo dy =......" ? please help!
      > here it is :
      > <%@ Import Namespace="Syst em.Web.Mail" %>
      > <Script Language="VB" Runat="Server">
      > Sub Send(sender As Object, e As EventArgs)
      > Dim objMail As New MailMessage()
      > objMail.From = FromWho.Text & "<" & FromMail.Text & ">"
      > objMail.To = "mail@address.c om"
      > objMail.BodyFor mat = MailFormat.Text
      > objMail.BodyEnc oding = Encoding.ASCII
      > objMail.Subject = "Order"
      > objMail.Body =request.Form(" tform""'FromWho ','FromMail','t el','address'")
      >
      > SmtpMail.SmtpSe rver = "mail.server.co m"
      > SmtpMail.Send(o bjMail)
      > Response.Redire ct("abc.htm")
      > End Sub
      > </Script>
      > <Html>
      > <Head>
      > <Title>Tester </Title>
      > </Head>
      > <Body>
      >
      > <Form Runat="Server" id=tform>
      > Namer : <Asp:TextBox Runat="Server" Id="FromWho" Columns="7" /> <br>
      > Email Address : <Asp:TextBox Runat="Server" Id="FromMail" Columns="20" /><br>
      > Tel : <Asp:TextBox Runat="Server" Id="tel" Columns="8" /><br>
      > Address : <Asp:TextBox Runat="Server" Id="address" Columns="20" /><br>
      >
      >
      > <Asp:Button Runat="Server" OnClick="Send" text="Send" />
      > </Center>
      > </Form>
      >
      >
      > </Body>
      > </Html>[/color]

      Comment

      Working...