PDF Form E-mail Send (Or as an appropirate way to may e-mail)

Rate It (1)

Last post 11-13-2009 11:50 AM by tugberk_ugurlu_. 29 replies.

Sort Posts:

  • PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-07-2009, 9:02 AM

    Hi Folks ! I have a website called www.tugberkugurlu.com and I am sort of new on this “writing code” thing. I have created a page linked http://www.tugberkugurlu.com/pdf_form/copy%20of%20default.aspx and it contains a form that enables to enter the values there. Also I can indentify the validation I want to and I did (Except the one which I need to apply on a checkbox because I do not know how to do this) . Also you can post this form as well and it comes to my mail but It can only come to my e-mail roughly. Also I can get only two of the text box. You can have a look at the form and you can try it if you want.

    I wrote this code inside the seperate VB code file (this is the code I got from one of the videos in www.asp.net );

    Imports System.Net.Mail

     

     

    Partial Class PDF_Form_Default

        Inherits System.Web.UI.Page

     

        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

            SendMail(firstname.Text, lastname.Text)

        End Sub

     

        Private Sub SendMail(ByVal from As String, ByVal body As String)

            Dim mailServerName As String = "my mail host"

            Dim message As MailMessage = New MailMessage(from, "my e-mail address", "You Have A Message !", body)

            Dim mailclient As SmtpClient = New SmtpClient

     

            mailclient.Host = mailServerName

            mailclient.Send(message)

            message.Dispose()

        End Sub

     

    End Class

    Above code is really not working by the way.

    What I want is as follows;

     

    1. I would like to get this form to my e-mail as attached file as pdf. I want it to look like as just on the form.
    2. If it is not possible, I woul like to get this form to my e-mail as a table or embeded html format to my e-mail.
    3. “Firstname” text box refers to First Name & “lastname” refers to last name and I would like to get the as subjected that “You have a message from firstname lastname”
    4. I would like to make a validation that enables not to post the form unless you check the check box as you can see above the submit button. Also is it possible to get the IP address of the person who posted it when they checked the check box ?
    5. Also I have dropdown’s and how can I get the value of them to my e-mail?
    6. And how can I make them related to each other (dropdowns).?

     

     

    I ma using WWD 2008 Express Edition if it matters.

    It is really important for me and I await dor your replies.

    Best Wishes,

    Tugberk

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-07-2009, 12:55 PM
    • Contributor
      4,419 point Contributor
    • fayaz_3e
    • Member since 09-14-2007, 10:15 AM
    • Hyderabad
    • Posts 903

    I would like to get this form to my e-mail as attached file as pdf. I want it to look like as just on the form.

    You can use iTextSharp for pdf. Its free. You can convert html to pdf and a lot more.

    http://itextsharp.sourceforge.net/

    If it is not possible, I woul like to get this form to my e-mail as a table or embeded html format to my e-mail.

    I will go for this option. This is pretty simple. Create a table and make ur body ishtml to true.

    Get Textbox values and create mail body.

    “Firstname” text box refers to First Name & “lastname” refers to last name and I would like to get the as subjected that “You have a message from firstname lastname”

    You can get textbox values from text property. If the first name text box id is txtFirstName then txtFirstName.Text similalrly last name...

    I would like to make a validation that enables not to post the form unless you check the check box as you can see above the submit button. Also is it possible to get the IP address of the person who posted it when they checked the check box

    Write a javacsript function for it.

    Refer this

    http://forums.asp.net/t/1267124.aspx#2384237

    Also I have dropdown’s and how can I get the value of them to my e-mail

    You can get from selected value property. If id is ddlCity them ddlCity.SelectedValue

    And how can I make them related to each other (dropdowns)

    That can be done in code. Disable the second one. On first selection populate the second and enable it. If using AJAX, then cascaded drop down list is better

    http://www.asp.net/AJAX/AjaxControlToolkit/Samples/CascadingDropDown/CascadingDropDown.aspx

    Fayaz
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-09-2009, 5:16 AM

    Hi. Thank you for your answer and your time. But I have some questionas 

    I will go for this option. This is pretty simple. Create a table and make ur body ishtml to true.

    Get Textbox values and create mail body.

    How can I do that? can you give me an exapmle as code? As you can see in my form page I have a button and when it is clicked (of course after required field filled in) ı want to make the form to my e-mail as a table which looks like nice and they aoutomatically go to next page which shows "you are done, you form has been sent bla bla bla..." Please giv me an example refers to this.

    Write a javacsript function for it. Refer this http://forums.asp.net/t/1267124.aspx#2384237

    I did this with this code and it works perfectly!

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="checkboxvali.aspx.vb" Inherits="js_checkboxvali" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    
    <title>Untitled Page</title>
    
    <script type="text/javascript">
    
     
    
    <!--
        function ensureChecked(source, args) {
            var cb = document.getElementById('CheckBox1');
    
            if (cb.checked == true) {
                args.IsValid = true;
    
            } else {
                args.IsValid = false;
            }
        }
    -->
    </script> 
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:CheckBox ID="CheckBox1" runat="server" />
    <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ensureChecked"
    ErrorMessage="* Must check checkbox for postback"></asp:CustomValidator>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Button" />
    </div>
    </form> 
    </body>
    </html>


    In my form with this validation, I would like to get the IP address of the client on the bottom of the form which comes to my e-mail.

    Also for the dropdown, can you write a code for me to make them related to each other?

    I really need this and I hope it will be useful for the other asp.net visitors.

    Thanks in advance ! 

    Tugberk

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-09-2009, 6:37 AM
    • Contributor
      4,419 point Contributor
    • fayaz_3e
    • Member since 09-14-2007, 10:15 AM
    • Hyderabad
    • Posts 903

    Paste your page HTML. I can try some mail body...

    Fayaz
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-09-2009, 8:38 AM

    This the code of the page. It is an aspx page;

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Copy of Default.aspx.vb" Inherits="PDF_Form_Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <script type="text/javascript">
    <!--
        function ensureChecked(source, args) {
            var cb = document.getElementById('CheckBox1');
            if (cb.checked == true) {
                args.IsValid = true;
            } else {
                args.IsValid = false;
            }
        }
    -->
    </script> 
        <title>Pdf Form Sample</title>
        <link href="pdfform.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            .style1
            {
                width: 100%;
            }
            .style3
            {
                width: 172px;
                font-weight: 700;
            }
            .style4
            {
                width: 19px;
            }
            .style5
            {
                font-weight: 700;
                font-family: "Times New Roman", Times, serif;
                color: #FFFFFF;
                text-align: left;
                background-color: #808080;
            }
            .style6
            {
                text-align: center;
                font-weight: 700;
            }
            .style7
            {
                color: #3399FF;
                font-weight: bold;
            }
            .style8
            {
                width: 350px;
            }
            .style10
            {
                width: 19px;
                height: 26px;
            }
            .style11
            {
                height: 26px;
            }
            .style12
            {
                width: 172px;
            }
            .style13
            {
                text-align: center;
                font-weight: 700;
                width: 172px;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        
        <table class="style1">
            <tr>
                <td class="style12" rowspan="2">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style10">
                    </td>
                <td colspan="2" class="style11">
                    </td>
            </tr>
            <tr>
                <td class="style12" rowspan="2">
                    <img alt="Erasmus Logo" src="../images/Erasmus.jpg" 
                        style="width: 136px; height: 45px" /></td>
                <td class="style4" rowspan="2">
                     </td>
                <td class="style7" colspan="2">
                    ERASMUS LLP</td>
            </tr>
            <tr>
                <td class="style7" colspan="2">
                    APPLICATION FORM FOR TURKISH UNIVERSITIES</td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style5" colspan="4">
                    Personal Details</td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    First Name</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="firstname" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ErrorMessage="Please Enter Your Name !" ControlToValidate="firstname">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Last Name</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="lastname" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="lastname" ErrorMessage="Please Enter Your LastName !">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Telephone Number</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox3" runat="server" Width="54px" MaxLength="3" 
                        ToolTip="Your City Telephone Code Here"></asp:TextBox>
     <asp:TextBox ID="TextBox9" runat="server" Width="131px" MaxLength="7" 
                        ToolTip="Your Landline Number Without City Code"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                        ErrorMessage="Please Enter Your Landline Number City Code !" 
                        ControlToValidate="TextBox3">*</asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                        ErrorMessage="Please Enter Your Landline Phone !" 
                        ControlToValidate="TextBox9">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox10" runat="server" Width="54px" MaxLength="3"></asp:TextBox>
     <asp:TextBox ID="TextBox11" runat="server" Width="131px" MaxLength="7"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                        ErrorMessage="Please Enter The Code of Your Mobile Phone Number !" 
                        ControlToValidate="TextBox10">*</asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                        ErrorMessage="Please Enter Your Mobile Phone Number !" 
                        ControlToValidate="TextBox11">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox12" runat="server" Width="54px" MaxLength="3"></asp:TextBox>
     <asp:TextBox ID="TextBox13" runat="server" Width="131px" MaxLength="7"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    E-mail Adress</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="emailtxt" runat="server" Width="287px"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="emailtxt" ErrorMessage="Please Enter Your E-mail Address">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="emailtxt" 
                        ErrorMessage="Please Enter A Valid E-mail Address !" 
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Address</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="addresstxt" runat="server" TextMode="MultiLine" Width="287px"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                        ErrorMessage="Please Enter Your Address !" ControlToValidate="addresstxt">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    City</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox8" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style5" colspan="4">
                    Education Details</td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Name of Universty</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox14" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Major</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox15" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Average Grade</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox16" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style5" colspan="4">
                    Other Details</td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style13">
                    Which City Would You Prefer ?</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:DropDownList ID="DropDownList1" runat="server" Height="21px" Width="186px">
                        <asp:ListItem Selected="True">I do not know</asp:ListItem>
                        <asp:ListItem>Dallas</asp:ListItem>
                        <asp:ListItem>Los Angeles</asp:ListItem>
                        <asp:ListItem>Miami</asp:ListItem>
                        <asp:ListItem>Memphis</asp:ListItem>
                        <asp:ListItem>Colorado</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style13">
                    What Kind of Job Would You Prefer ?</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:DropDownList ID="DropDownList2" runat="server" Height="21px" Width="186px">
                        <asp:ListItem Selected="True">I do not know</asp:ListItem>
                        <asp:ListItem>Fastfood Staff</asp:ListItem>
                        <asp:ListItem>Restaurants</asp:ListItem>
                        <asp:ListItem>As Lifeguard</asp:ListItem>
                        <asp:ListItem>Hotel Staff</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style13">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style6" colspan="4">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                        style="text-align: center" />
                </td>
            </tr>
            <tr>
                <td class="style6" colspan="4">
                    <asp:CheckBox ID="CheckBox1" Text="I have read the aggrement and I accept it." 
                        runat="server" style="text-align: center" />
                        <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ensureChecked"
    ErrorMessage="* Must check checkbox for postback"></asp:CustomValidator>
                </td>
            </tr>
        </table>
        <table class="style1">
            <tr>
                <td class="style6">
                     </td>
            </tr>
            <tr>
                <td class="style6">
                    <asp:Button ID="Button1" runat="server" Text="Submit The Form" Width="125px" />
                </td>
            </tr>
            <tr>
                <td class="style6">
                     </td>
            </tr>
        </table>
        
        </form>
    </body>
    </html>


     

     

    And this is the code of the VB page seperately but It does't work. Please advice me a new e-mail send function in VB.

    Imports System.Net.Mail
    
    
    Partial Class PDF_Form_Default
        Inherits System.Web.UI.Page
    
        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
            SendMail(firstname.Text, lastname.Text)
        End Sub
    
        Private Sub SendMail(ByVal from As String, ByVal body As String)
            Dim mailServerName As String = "mail.tugberkugurlu.com"
            Dim message As MailMessage = New MailMessage(from, "info@tugberkugurlu.com", "You Have A Message !", body)
            Dim mailclient As SmtpClient = New SmtpClient
    
            mailclient.Host = mailServerName
            mailclient.Send(message)
            message.Dispose()
        End Sub
    
    End Class
    


     

     

    Also please can you add the code of that When the check box is ticked, I want the IP address of the user to my e-mail on the bottom of the form.

     

    Thank you vey much. You are a god send

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-09-2009, 8:44 AM
    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Copy of Default.aspx.vb" Inherits="PDF_Form_Default" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <script type="text/javascript">
    <!--
        function ensureChecked(source, args) {
            var cb = document.getElementById('CheckBox1');
            if (cb.checked == true) {
                args.IsValid = true;
            } else {
                args.IsValid = false;
            }
        }
    -->
    </script> 
        <title>Pdf Form Sample</title>
        <link href="pdfform.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            .style1
            {
                width: 100%;
            }
            .style3
            {
                width: 172px;
                font-weight: 700;
            }
            .style4
            {
                width: 19px;
            }
            .style5
            {
                font-weight: 700;
                font-family: "Times New Roman", Times, serif;
                color: #FFFFFF;
                text-align: left;
                background-color: #808080;
            }
            .style6
            {
                text-align: center;
                font-weight: 700;
            }
            .style7
            {
                color: #3399FF;
                font-weight: bold;
            }
            .style8
            {
                width: 350px;
            }
            .style10
            {
                width: 19px;
                height: 26px;
            }
            .style11
            {
                height: 26px;
            }
            .style12
            {
                width: 172px;
            }
            .style13
            {
                text-align: center;
                font-weight: 700;
                width: 172px;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        
        <table class="style1">
            <tr>
                <td class="style12" rowspan="2">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style10">
                    </td>
                <td colspan="2" class="style11">
                    </td>
            </tr>
            <tr>
                <td class="style12" rowspan="2">
                    <img alt="Erasmus Logo" src="../images/Erasmus.jpg" 
                        style="width: 136px; height: 45px" /></td>
                <td class="style4" rowspan="2">
                     </td>
                <td class="style7" colspan="2">
                    ERASMUS LLP</td>
            </tr>
            <tr>
                <td class="style7" colspan="2">
                    APPLICATION FORM FOR TURKISH UNIVERSITIES</td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style5" colspan="4">
                    Personal Details</td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    First Name</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="firstname" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ErrorMessage="Please Enter Your Name !" ControlToValidate="firstname">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Last Name</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="lastname" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="lastname" ErrorMessage="Please Enter Your LastName !">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Telephone Number</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox3" runat="server" Width="54px" MaxLength="3" 
                        ToolTip="Your City Telephone Code Here"></asp:TextBox>
     <asp:TextBox ID="TextBox9" runat="server" Width="131px" MaxLength="7" 
                        ToolTip="Your Landline Number Without City Code"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                        ErrorMessage="Please Enter Your Landline Number City Code !" 
                        ControlToValidate="TextBox3">*</asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                        ErrorMessage="Please Enter Your Landline Phone !" 
                        ControlToValidate="TextBox9">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox10" runat="server" Width="54px" MaxLength="3"></asp:TextBox>
     <asp:TextBox ID="TextBox11" runat="server" Width="131px" MaxLength="7"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                        ErrorMessage="Please Enter The Code of Your Mobile Phone Number !" 
                        ControlToValidate="TextBox10">*</asp:RequiredFieldValidator>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                        ErrorMessage="Please Enter Your Mobile Phone Number !" 
                        ControlToValidate="TextBox11">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox12" runat="server" Width="54px" MaxLength="3"></asp:TextBox>
     <asp:TextBox ID="TextBox13" runat="server" Width="131px" MaxLength="7"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    E-mail Adress</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="emailtxt" runat="server" Width="287px"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="emailtxt" ErrorMessage="Please Enter Your E-mail Address">*</asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                        ControlToValidate="emailtxt" 
                        ErrorMessage="Please Enter A Valid E-mail Address !" 
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Address</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="addresstxt" runat="server" TextMode="MultiLine" Width="287px"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                        ErrorMessage="Please Enter Your Address !" ControlToValidate="addresstxt">*</asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    City</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox8" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style5" colspan="4">
                    Education Details</td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Name of Universty</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox14" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Major</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox15" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                    Average Grade</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:TextBox ID="TextBox16" runat="server" Width="186px"></asp:TextBox>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style5" colspan="4">
                    Other Details</td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style13">
                    Which City Would You Prefer ?</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:DropDownList ID="DropDownList1" runat="server" Height="21px" Width="186px">
                        <asp:ListItem Selected="True">I do not know</asp:ListItem>
                        <asp:ListItem>Dallas</asp:ListItem>
                        <asp:ListItem>Los Angeles</asp:ListItem>
                        <asp:ListItem>Miami</asp:ListItem>
                        <asp:ListItem>Memphis</asp:ListItem>
                        <asp:ListItem>Colorado</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style3">
                     </td>
                <td class="style4">
                     </td>
                <td class="style8">
                     </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style13">
                    What Kind of Job Would You Prefer ?</td>
                <td class="style4">
                    :</td>
                <td class="style8">
                    <asp:DropDownList ID="DropDownList2" runat="server" Height="21px" Width="186px">
                        <asp:ListItem Selected="True">I do not know</asp:ListItem>
                        <asp:ListItem>Fastfood Staff</asp:ListItem>
                        <asp:ListItem>Restaurants</asp:ListItem>
                        <asp:ListItem>As Lifeguard</asp:ListItem>
                        <asp:ListItem>Hotel Staff</asp:ListItem>
                    </asp:DropDownList>
                </td>
                <td>
                     </td>
            </tr>
            <tr>
                <td class="style13">
                     </td>
                <td class="style4">
                     </td>
                <td colspan="2">
                     </td>
            </tr>
            <tr>
                <td class="style6" colspan="4">
                    <asp:ValidationSummary ID="ValidationSummary1" runat="server" 
                        style="text-align: center" />
                </td>
            </tr>
            <tr>
                <td class="style6" colspan="4">
                    <asp:CheckBox ID="CheckBox1" Text="I have read the aggrement and I accept it." 
                        runat="server" style="text-align: center" />
                        <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ensureChecked"
    ErrorMessage="* Must check checkbox for postback"></asp:CustomValidator>
                </td>
            </tr>
        </table>
        <table class="style1">
            <tr>
                <td class="style6">
                     </td>
            </tr>
            <tr>
                <td class="style6">
                    <asp:Button ID="Button1" runat="server" Text="Submit The Form" Width="125px" />
                </td>
            </tr>
            <tr>
                <td class="style6">
                     </td>
            </tr>
        </table>
        
        </form>
    </body>
    </html>


     Here is the code !

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-10-2009, 7:37 AM
    • Contributor
      4,419 point Contributor
    • fayaz_3e
    • Member since 09-14-2007, 10:15 AM
    • Hyderabad
    • Posts 903

    Add a simple html page to ur solution. Name it as pdf.htm. Copy the following and paste it in this pdf.htm

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <style type="text/css">
            .style1
            {
                width: 100%;
            }
            .style3
            {
                width: 172px;
                font-weight: 700;
            }
            .style4
            {
                width: 19px;
            }
            .style5
            {
                font-weight: 700;
                font-family: "Times New Roman" , Times, serif;
                color: #FFFFFF;
                text-align: left;
                background-color: #808080;
            }
            .style6
            {
                text-align: center;
                font-weight: 700;
            }
            .style7
            {
                color: #3399FF;
                font-weight: bold;
            }
            .style8
            {
                width: 350px;
            }
            .style10
            {
                width: 19px;
                height: 26px;
            }
            .style11
            {
                height: 26px;
            }
            .style12
            {
                width: 172px;
            }
            .style13
            {
                text-align: center;
                font-weight: 700;
                width: 172px;
            }
        </style>
    </head>
    <body>
        <table class="style1">
            <tr>
                <td class="style12" rowspan="2">
                </td>
                <td class="style4">
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td class="style10">
                </td>
                <td colspan="2" class="style11">
                </td>
            </tr>
            <tr>
                <td class="style12" rowspan="2">
                    <img alt="Erasmus Logo" src="../images/Erasmus.jpg" style="width: 136px; height: 45px" />
                </td>
                <td class="style4" rowspan="2">
                </td>
                <td class="style7" colspan="2">
                    ERASMUS LLP
                </td>
            </tr>
            <tr>
                <td class="style7" colspan="2">
                    APPLICATION FORM FOR TURKISH UNIVERSITIES
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td class="style5" colspan="4">
                    Personal Details
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td class="style3">
                    First Name
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplaceFirstName
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    Last Name
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplaceLastName
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    Telephone Number
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplaceTelephoneCode1   ReplaceTelephoneNo1            </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                    ReplaceTelephoneCode2   ReplaceTelephoneNo2            </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                    ReplaceTelephoneCode3   ReplaceTelephoneNo3
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    E-mail Adress
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplaceEmail
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    Address
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplaceAddress
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    City
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplaceCity
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td class="style5" colspan="4">
                    Education Details
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td class="style3">
                    Name of Universty
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplaceUniversity
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    Major
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplaceMajor
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                    Average Grade
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplaceAverage
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td class="style5" colspan="4">
                    Other Details
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td class="style13">
                    Which City Would You Prefer ?
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplacePreferCity
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style3">
                </td>
                <td class="style4">
                </td>
                <td class="style8">
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style13">
                    What Kind of Job Would You Prefer ?
                </td>
                <td class="style4">
                    :
                </td>
                <td class="style8">
                    ReplacePreferJob
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td class="style13">
                </td>
                <td class="style4">
                </td>
                <td colspan="2">
                </td>
            </tr>
            <tr>
                <td class="style6" colspan="4">
                </td>
            </tr>
            <tr>
                <td class="style6" colspan="4">
                </td>
            </tr>
        </table>
    </body>
    </html>
    

    Now we should read this html and modify accordingly by replacing with proper values. For that we can use a small function

    Public Function GetHtml(sUrl As String) As String
    	Dim oWebRequest As WebRequest = System.Net.HttpWebRequest.Create(sUrl)
    	Dim oStreamReader As New StreamReader(oWebRequest.GetResponse().GetResponseStream())
    
    	Dim sResult As String = oStreamReader.ReadToEnd()
    	oStreamReader.Close()
    
    	Return sResult
    End Function


    Then we can replace the values

    Public Function ReplaceHtml() As String
    Dim body As String = GetHtml(Server.MapPath("~/pdf.htm"))
    body = body.Replace("ReplaceFirstName", firstname.Text)
    body = body.Replace("ReplaceLastName", lastname.Text)
    body = body.Replace("ReplaceTelephoneCode1", textbox3.Text)
    body = body.Replace("ReplaceTelephoneNo1",  textbox9.Text)
    body = body.Replace("ReplaceTelephoneCode2", textbox10.Text)
    body = body.Replace("ReplaceTelephoneNo2", textbox11.Text)
    body = body.Replace("ReplaceTelephoneCode3", textbox12.Text)
    body = body.Replace("ReplaceTelephoneNo3", textbox13.Text)
    body = body.Replace("ReplaceEmail", emailtxt.Text)
    body = body.Replace("ReplaceAddress", addresstxt.Text)
    body = body.Replace("ReplaceCity", textbox8.Text)
    body = body.Replace("ReplaceUniversity", textbox14.Text)
    body = body.Replace("ReplaceMajor", textbox15.Text)
    body = body.Replace("ReplaceAverage", textbox16.Text)
    body = body.Replace("ReplacePreferCity", DropDownList1.SelectedItem.Text.ToString())
    body = body.Replace("ReplacePreferJob", DropDownList2.SelectedItem.Text.ToString())
    Return body
    End Function


    And ur Send mail is

     Private Sub SendMail(ByVal from As String, ByVal body As String)
            Dim mailServerName As String = "my mail host"
    	Dim body As String = ReplaceHtml()
            Dim message As MailMessage = New MailMessage(from, "my e-mail address", "You Have A Message !", body)
            message.IsBodyHtml = True
            Dim mailclient As SmtpClient = New SmtpClient
    
            mailclient.Host = mailServerName
            mailclient.Send(message)
            message.Dispose()



    Fayaz
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-11-2009, 7:19 AM

    Hi there ! First of all thans for all of your help. I did what you mendioned but I get errors when I go to http://www.tugberkugurlu.com/pdf_form/copy%20of%20default.aspx I wrote copy and paste the html code to the page pdf.htm as you said. And then I wrote the others to my copy of default.aspx.vb and its last view is as follows;

    Imports System.Net.Mail
    
    
    Partial Class PDF_Form_Default
        Inherits System.Web.UI.Page
    
        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
            SendMail(firstname.Text, lastname.Text)
        End Sub
        Public Function GetHtml(ByVal sUrl As String) As String
            Dim oWebRequest As WebRequest = System.Net.HttpWebRequest.Create(sUrl)
            Dim oStreamReader As New StreamReader(oWebRequest.GetResponse().GetResponseStream())
    
            Dim sResult As String = oStreamReader.ReadToEnd()
            oStreamReader.Close()
    
            Return sResult
        End Function
        Public Function ReplaceHtml() As String
            Dim body As String = GetHtml(Server.MapPath("~/pdf.htm"))
            body = body.Replace("ReplaceFirstName", firstname.Text)
            body = body.Replace("ReplaceLastName", lastname.Text)
            body = body.Replace("ReplaceTelephoneCode1", textbox3.Text)
            body = body.Replace("ReplaceTelephoneNo1", textbox9.Text)
            body = body.Replace("ReplaceTelephoneCode2", textbox10.Text)
            body = body.Replace("ReplaceTelephoneNo2", textbox11.Text)
            body = body.Replace("ReplaceTelephoneCode3", textbox12.Text)
            body = body.Replace("ReplaceTelephoneNo3", textbox13.Text)
            body = body.Replace("ReplaceEmail", emailtxt.Text)
            body = body.Replace("ReplaceAddress", addresstxt.Text)
            body = body.Replace("ReplaceCity", textbox8.Text)
            body = body.Replace("ReplaceUniversity", textbox14.Text)
            body = body.Replace("ReplaceMajor", textbox15.Text)
            body = body.Replace("ReplaceAverage", textbox16.Text)
            body = body.Replace("ReplacePreferCity", DropDownList1.SelectedItem.Text.ToString())
            body = body.Replace("ReplacePreferJob", DropDownList2.SelectedItem.Text.ToString())
            Return body
        End Function
    
        Private Sub SendMail(ByVal from As String, ByVal body As String)
            Dim mailServerName As String = "mail.tugberkugurlu.com"
            Dim body As String = ReplaceHtml()
            Dim message As MailMessage = New MailMessage(from, "info@tugberkugurlu.com", "You Have A Message !", body)
            message.IsBodyHtml = True
            Dim mailclient As SmtpClient = New SmtpClient
    
            mailclient.Host = mailServerName
            mailclient.Send(message)
            message.Dispose()
        End Sub
    
    End Class


    Did I do anything wrong? I get this error when I go to the page;

    Server Error in '/' Application.
    --------------------------------------------------------------------------------
    
    Compilation Error 
    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 
    
    Compiler Error Message: BC30002: Type 'WebRequest' is not defined.
    
    Source Error:
    
     
    
    Line 9:      End Sub
    Line 10:     Public Function GetHtml(ByVal sUrl As String) As String
    Line 11:         Dim oWebRequest As WebRequest = System.Net.HttpWebRequest.Create(sUrl)
    Line 12:         Dim oStreamReader As New StreamReader(oWebRequest.GetResponse().GetResponseStream())
    Line 13: 
     
    
    Source File: d:\inetpub\tugberkugurlu.com\www\pdf_form\Copy of Default.aspx.vb    Line: 11 
    
    
    
    Show Detailed Compiler Output:
    
    
    d:\inetpub\mervekarnem.com\www> "C:\WINDOWS\Microsoft.NET\Framework\v3.5\vbc.exe" /t:library /utf8output /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\3.5.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Abstractions\3.5.0.0__31bf3856ad364e35\System.Web.Abstractions.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Routing\3.5.0.0__31bf3856ad364e35\System.Web.Routing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.DynamicData\3.5.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Entity\3.5.0.0__b77a5c561934e089\System.Web.Entity.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Data.Linq\3.5.0.0__b77a5c561934e089\System.Data.Linq.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Data.Entity\3.5.0.0__b77a5c561934e089\System.Data.Entity.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.dll" /D:DEBUG=1 /debug+ /win32resource:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\_ge0ajcy.res" /define:_MYTYPE=\"Web\" /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Collections.Specialized,System.Configuration,System.Text,System.Text.RegularExpressions,System.Linq,System.Xml.Linq,System.Web,System.Web.Caching,System.Web.SessionState,System.Web.Security,System.Web.Profile,System.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.Web.UI.HtmlControls /warnaserror- /optionInfer+  "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.10.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.1.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.0.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.3.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.5.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.4.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.9.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.6.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.8.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.2.vb" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9dad7f9\e2af673c\App_Web__ge0ajcy.7.vb"
    
    
    
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082 


    Can you tell me what do I need to do ? Do I need to add the first function named GetHtml to the pdf.htm file?

     

    I await for your reply.

     

    Thanks dude !

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-11-2009, 7:36 AM

    Dim oWebRequest As WebRequest = System.Net.HttpWebRequest.Create(sUrl)

    Dim oStreamReader As New StreamReader(oWebRequest.GetResponse().GetResponseStream())

    It says there is something wrong with these two that I underlined !

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-11-2009, 7:44 AM

    I guess I sorted the problem out but a new error occured !

    My new vb file is like this;

    Imports System.Net.Mail
    Imports System.IO
    Imports System.Net
    
    
    Partial Class PDF_Form_Default
        Inherits System.Web.UI.Page
    
        Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
            SendMail(firstname.Text, lastname.Text)
        End Sub
    
        Public Function GetHtml(ByVal sUrl As String) As String
            Dim oWebRequest As WebRequest = System.Net.HttpWebRequest.Create(sUrl)
            Dim oStreamReader As New StreamReader(oWebRequest.GetResponse().GetResponseStream())
    
            Dim sResult As String = oStreamReader.ReadToEnd()
            oStreamReader.Close()
    
            Return sResult
        End Function
    
        Public Function ReplaceHtml() As String
            Dim body As String = GetHtml(Server.MapPath("~/pdf.htm"))
            body = body.Replace("ReplaceFirstName", firstname.Text)
            body = body.Replace("ReplaceLastName", lastname.Text)
            body = body.Replace("ReplaceTelephoneCode1", TextBox3.Text)
            body = body.Replace("ReplaceTelephoneNo1", TextBox9.Text)
            body = body.Replace("ReplaceTelephoneCode2", TextBox10.Text)
            body = body.Replace("ReplaceTelephoneNo2", TextBox11.Text)
            body = body.Replace("ReplaceTelephoneCode3", TextBox12.Text)
            body = body.Replace("ReplaceTelephoneNo3", TextBox13.Text)
            body = body.Replace("ReplaceEmail", emailtxt.Text)
            body = body.Replace("ReplaceAddress", addresstxt.Text)
            body = body.Replace("ReplaceCity", TextBox8.Text)
            body = body.Replace("ReplaceUniversity", TextBox14.Text)
            body = body.Replace("ReplaceMajor", TextBox15.Text)
            body = body.Replace("ReplaceAverage", TextBox16.Text)
            body = body.Replace("ReplacePreferCity", DropDownList1.SelectedItem.Text.ToString())
            body = body.Replace("ReplacePreferJob", DropDownList2.SelectedItem.Text.ToString())
            Return body
        End Function
    
        Private Sub SendMail(ByVal from As String, ByVal body As String)
            Dim mailServerName As String = "mail.tugberkugurlu.com"
            Dim body As String = ReplaceHtml()
            Dim message As MailMessage = New MailMessage(from, "info@tugberkugurlu.com", "You Have A Message !", body)
            message.IsBodyHtml = True
            Dim mailclient As SmtpClient = New SmtpClient
    
            mailclient.Host = mailServerName
            mailclient.Send(message)
            message.Dispose()
        End Sub
    
    End Class


     and new error is as this;

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC30734: 'body' is already declared as a parameter of this method.

    Source Error:

    Line 44:     Private Sub SendMail(ByVal from As String, ByVal body As String)
    Line 45:         Dim mailServerName As String = "mail.tugberkugurlu.com"
    Line 46:         Dim body As String = ReplaceHtml()
    Line 47:         Dim message As MailMessage = New MailMessage(from, "info@tugberkugurlu.com", "You Have A Message !", body)
    Line 48:         message.IsBodyHtml = True


    Source File: d:\inetpub\tugberkugurlu.com\www\pdf_form\Copy of Default.aspx.vb    Line: 46

    I need your help here dude :(

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-11-2009, 7:52 AM
    • Contributor
      4,419 point Contributor
    • fayaz_3e
    • Member since 09-14-2007, 10:15 AM
    • Hyderabad
    • Posts 903

    Modify this 

    Dim body As String = ReplaceHtml()

    to

    body = ReplaceHtml()
    Fayaz
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-11-2009, 8:08 AM

    hi fayaz! thanks a lot. It works but a new one occured again :)

    It says as indicated below;

     

    Server Error in '/' Application.

    The specified string is not in the form required for an e-mail address.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.FormatException: The specified string is not in the form required for an e-mail address.

    Source Error:

    Line 45:         Dim mailServerName As String = "mail.tugberkugurlu.com"
    Line 46:         body = ReplaceHtml()
    Line 47:         Dim message As MailMessage = New MailMessage(from, "info@tugberkugurlu.com", "You Have A Message !", body)
    Line 48:         message.IsBodyHtml = True
    Line 49:         Dim mailclient As SmtpClient = New SmtpClient


    Source File: d:\inetpub\tugberkugurlu.com\www\pdf_form\Copy of Default.aspx.vb    Line: 47

    I await your hepls again :(

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-11-2009, 8:09 AM

    you can try it as yourself it it hepls;

    http://www.tugberkugurlu.com/pdf_form/copy%20of%20default.aspx 

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-11-2009, 8:32 AM
    • Contributor
      4,419 point Contributor
    • fayaz_3e
    • Member since 09-14-2007, 10:15 AM
    • Hyderabad
    • Posts 903

    Give valid from address.

    Change this line

    Dim message As MailMessage = New MailMessage(from, "info@tugberkugurlu.com", "You Have A Message !", body)

    to

    Dim message As MailMessage = New MailMessage("from@tugberkugurlu.com", "info@tugberkugurlu.com", "You Have A Message !", body)

    The first param is valid from email id, second is valid to email id, third is subject and fourth is body.

    Fayaz
  • Re: PDF Form E-mail Send (Or as an appropirate way to may e-mail)

    11-11-2009, 8:38 AM

    Fayaz. I am so grateful all along for you support and help. I would like to use the textbox of the mail address in the form as sender. How could I do that? Is it possible? Plese advise me the way of that ! thanks dude ;) 

    Tugberk Ugurlu (WWD 2008 Express Edition / VB)
Page 1 of 2 (30 items) 1 2 Next >