Can anyone put a quick patch on this script I want it to send the email even if a file does not exist right now I get an error if I try to send it with no file

<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Mail" %>
<%@ Import Namespace="System.IO" %>
<html>
<head>
<title>Atlantic Golf LLC</title>
<link rel=STYLESHEET href="./css/stdstyles.css" type="text/css">
<link rel=STYLESHEET href="./css/bodystyles.css">
<link rel=STYLESHEET href="./css/controlstyles.css">
<meta name="description" content="AtlanticGolf.net LLC is a partnership of golf industry leaders who help improve golf course profitability.">
<meta name="keywords" content="Atlantic golf, atlanticgolf.net, philadelphia golf course management, golf course management, golf course management company, golf club management, luxury golf course management">
<script type="text/javascript">
<!--
    function dropdown(mySel) {
        var myWin, myVal;
        myVal = mySel.options[mySel.selectedIndex].value;
        if (myVal) {
            if (mySel.form.target) myWin = parent[mySel.form.target];
            else myWin = window;
            if (!myWin) return true;
            myWin.location = myVal;
        }
        return false;
    }
//-->
</script>
<script language = "javascript">
    function Tocheck(frmemail) {
        if (frmemail.txtFile.value == "") {
            alert("Please attach a file");
            frmemail.txtFile.focus();
            return (false);
        }
    }
</script>

<script runat="server">

void btnSubmit_Click(Object sender, EventArgs e) {
    Form.Visible = false;
    Message.Visible = true;
    Details.Visible = false;
MailMessage mail = new MailMessage();
mail.From = "info@abc.com";
mail.To = "My Email Address";
mail.Subject = "AtlanticGolf.net LLC Query re: Employment";
                    mail.Body = "Name: " +  txtName.Text.Trim() + "<br>";
                    mail.Body += "Email: " + txtEmail.Text.Trim() + "<br>";
                    mail.Body += "Address: " + txtAddress.Text.Trim() + "<br>";                    
                    mail.Body += "Address2: " + txtAddress2.Text.Trim() + "<br>";
                    mail.Body += "City: " + txtCity.Text.Trim() + "<br>";
                    mail.Body += "State: " + txtState.Text.Trim() + "<br>";
                    mail.Body += "Phone: " + txtPhone.Text.Trim() + "<br>";
                    mail.Body += "Details: " + txtDetails.Text.Trim() + "<br>";
mail.BodyFormat = MailFormat.Html;

string strdir = "c:\182404wf6\\temp\\";

string strfilename = Path.GetFileName(txtFile.PostedFile.FileName);

txtFile.PostedFile.SaveAs(strdir+strfilename);

mail.Attachments.Add(new MailAttachment(strdir+strfilename));

try
{ 
SmtpMail.Send(mail); 
} 
catch(Exception ex)
{
Response.Write("<b>Exception Occured:</b>   " +ex);
}
finally
{
Response.Write("");
}

// Uploaded file deleted after sending e-mail

File.Delete(strdir+strfilename);
}

protected void Page_Load(object sender, EventArgs e)
{
    Message.Visible = false;
}
</script>  

    <style type="text/css">
        .style1
        {
            font-weight: normal;
            color: #055779;
        }
        .style2
        {
            width: 110px;
            font-size: 13px;
            display: block;
            text-decoration: none;
            font-weight: normal;
            color: #055779;
            height: 32px;
            line-height: 29px;
            text-align: center;
        }
        .style3
        {
            color: #055779;
        }
        .style4
        {
            font-family: Arial;
            color: #055779;
        }
    </style>

</head>

<body>

<div align="center">
  <table border="0" cellspacing="0" cellpadding="0" class="main">
    <!--END HARDCODE TOP-->


<!--HEADER-->

    <tr>
      <td align="center">
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr valign="top">
            <td align="left">
            
  


			</td>
          </tr>
          <tr valign="top">
            <td align="left">
            
  <img border="0" src="./images/header.jpg" width="938" height="240" class="style3"></td>
          </tr>
          <tr valign="top">
            <td align="left">
            
  <table class="mainmenu" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td align="left" valign="top" width="8">
		<img alt="" border="0" src="./images/menuleft.gif" width="8" height="41" 
              class="style3" /></td>
      <td align="center" valign="middle" nowrap="nowrap" style="background-image: url('images/menubg.gif')">
        <table border="0" cellspacing="0" cellpadding="0" width="608">
         <tr>
           <td nowrap="nowrap" width="608">

  <!--   START MENU     -->

<div class="menu" style="width: 888px; height: 37px">

<!--~~~~~~~~~~~~~~~~~~~~~~-->
<!--   HOME               -->
<!--~~~~~~~~~~~~~~~~~~~~~~-->

<ul>
<li>
<a class="style2" href="./index.html" title="Home">Home</font></a></li>


<!--~~~~~~~~~~~~~~~~~~~~~~-->
<!--  WHO WE ARE          -->
<!--~~~~~~~~~~~~~~~~~~~~~~-->

<li>
<a class="style2" href="./about.html" title="Who We Are">Who We Are </font><!--[if IE 7]><!--></a>
    <span class="style1"><!--<![endif]-->
    </span>
<!--[if lte IE 6]><table><tr><td><![endif]-->
	<ul>
	<li>
	<a class="drop" href="./about.html" title="About Us" style="color: #055779">About Us</a></li>
	<li>
	<a class="drop" href="./leadership.html" title="Our Leadership" 
            style="color: #055779">Our Leadership</a></li>
	</ul>
<!--[if lte IE 6]></td></tr></table><span class="style1"></a><![endif]-->
</li>


<!--~~~~~~~~~~~~~~~~~~~~~~-->
<!--   HOW WE WORK        -->
<!--~~~~~~~~~~~~~~~~~~~~~~-->

    </span>

<li>
<a class="style2" href="./strategy.html" title="HTML Tutorial">How We Work </font><!--[if IE 7]><!--></a>
    <span class="style1"><!--<![endif]-->
    </span>
<!--[if lte IE 6]><table><tr><td><![endif]-->
	<ul>
	<li>
	<a class="drop" href="./strategy.html" title="Strategy" style="color: #055779">Business Strategy</a></li>
	<li>
	<a class="drop" href="./mission.html" title="Mission" style="color: #055779">Mission</a></li>
	<li>
	<a class="drop" href="./vision.html" title="Vision" style="color: #055779">Vision</a></li>
	<li>
	<a class="drop" href="./principles.html" title="Principles" style="color: #055779">Principles</a></li>
	<li>
	<a class="drop" href="./location.html" title="Location" style="color: #055779">Location</a></li>
	</ul>
<!--[if lte IE 6]></td></tr></table><span class="style1"></a><![endif]-->
</li>


<!--~~~~~~~~~~~~~~~~~~~~~~-->
<!--   Our Services       -->
<!--~~~~~~~~~~~~~~~~~~~~~~-->

    </span>

<li>
<a class="style2" href="./process.html" title="FORUM">Our Services</font><!--[if IE 7]><!--></a><span 
        class="style1"><!--<![endif]--></span>
<!--[if lte IE 6]><table><tr><td><![endif]-->
	<ul>

	<li>
	<a class="drop" href="./process.html" title="7 Step Process" style="color: #055779">7 Step Process</a></li>
	<li>
	<a class="drop" href="./consulting.html" title="Consulting" style="color: #055779">Golf Club Consulting</a></li>
	<li>
	<a class="drop" href="./retainer.html" title="Annual Retainer Relationship" 
            style="color: #055779">Annual Retainer Relationship</a></li>
	<li>
	<a class="drop" href="./management.html" title="Management" style="color: #055779">Golf Club Management</a></li>
	<li>
	<a class="drop" href="./acquisition.html" title="Acquisition" 
            style="color: #055779">Golf Club Acquisition</a></li>
	</ul>
<!--[if lte IE 6]></td></tr></table><span class="style1"></a><![endif]-->
</li>


<!--~~~~~~~~~~~~~~~~~~~~~~-->
<!--   What Others Say    -->
<!--~~~~~~~~~~~~~~~~~~~~~~-->

    </span>

<li>
<a class="style2" href="./experience.html" title="What Others Say">What Others Say</font><!--[if IE 7]><!--></a><span 
        class="style1"><!--<![endif]--></span>
<!--[if lte IE 6]><table><tr><td><![endif]-->
	<ul>

	<li>
	<a class="drop" href="./experience.html" title="Experience" style="color: #055779">Experience</a></li>
	<li>
	<a class="drop" href="./public.html" title="Public Course Experience" 
            style="color: #055779">Public Course Experience</a></li>
	<li>
	<a class="drop" href="./daily.html" title="DAILY FEE GOLF COURSE EXPERIENCE" 
            style="color: #055779">Daily Fee Golf Course Experience</a></li>
	<li>
	<a class="drop" href="./highend.html" title="High-End Daily Couse Experience" 
            style="color: #055779">High-End Daily Couse Experience</a></li>
	<li>
	<a class="drop" href="./private.html" title="Private Couse Experience" 
            style="color: #055779">Private Couse Experience</a></li>
	<li>
	<a class="drop" href="./testimonials.html" title="Testimonials" 
            style="color: #055779">Testimonials</a></li>
	<li>
	<a class="drop" href="./links.html" title="Links" style="color: #055779">Links to currently managed courses</a></li>
	

	</ul>
<!--[if lte IE 6]></td></tr></table><span class="style1"></a><![endif]-->
</li>

<!--~~~~~~~~~~~~~~~~~~~~~~-->
<!--   Giving Back        -->
<!--~~~~~~~~~~~~~~~~~~~~~~-->

    </span>

<li><a class="style2" href="./giving_back.html">Giving Back</font></a></li>

<!--~~~~~~~~~~~~~~~~~~~~~~-->
<!--   MEDIA              -->
<!--~~~~~~~~~~~~~~~~~~~~~~-->

<li>
<a class="style2" href="./storeis.html" title="Media">Media</font><!--[if IE 7]><!--></a><span 
        class="style1"><!--<![endif]--></span>
<!--[if lte IE 6]><table><tr><td><![endif]-->
	<ul>

	<li>
	<a class="drop" href="./stories.html" title="Stories" style="color: #055779">Golf Stories</a></li>
	<li>
	<a class="drop" href="./news.html" title="Our Newsletters" style="color: #055779">Our Newsletter</a></li>
	<li>
	<a class="drop" href="./press.html" title="Press Releases" style="color: #055779">Our Press Releases</a></li>
	

	</ul>
<!--[if lte IE 6]></td></tr></table><span class="style1"></a><![endif]-->
</li>

<!--~~~~~~~~~~~~~~~~~~~~~~-->
<!--   CONTACT            -->
<!--~~~~~~~~~~~~~~~~~~~~~~-->

    </span>

<li>
<a class="style2" href="./contact.html" title="FORUM">
Contact</font><!--[if IE 7]><!--></a><span class="style1"><!--<![endif]--></span>
<!--[if lte IE 6]><table><tr><td><![endif]-->
	<ul>

	<li>
	<a class="drop" href="./contact.html" title="HTML Help" style="color: #055779">Contact Information</a></li>
	<li>
	<a class="drop" href="./reader.aspx" title="Web Design" style="color: #055779">Reader information</a></li>
	<li>
	<a class="drop" href="./join.aspx" title="Programming Languages" 
            style="color: #055779">Employment Information</a></li>
	<li>
	<a class="drop" href="./message.html" title="Web Hosting" style="color: #055779">Message Box</a></li>
	

	</ul>
<!--[if lte IE 6]></td></tr></table><span class="style1"></a></span><![endif]-->
</li>

</div>


            </td>
           
          </tr>
        </table>
      </td>
      <td align="right" valign="top" width="8">
		<img alt="" border="0" style="vertical-align:top;" src="./images/menuright.gif" 
              width="8" height="41" class="style3" /></td>
    </tr>
    </table>

  <!--END MAIN MENU--> 
  
  
  </td>
          </tr>
          </table>
      </td>
    </tr>
  </table>
  <table border="0" cellspacing="0" cellpadding="0" class="main" width="937" style="background-color: #F2EFEC">
    <tr>
      <td valign="top" width="937">

          <span class="style3">

<!--END HEADER-->

        <!--SECTION NAV1-->
          </span>
        <table id="nav2" class="nav2" width="100%"><tr><td>
    
		

<table width="103%" >
<tr><td align=RIGHT width="69">
	
<img src="./images/header_management.jpg"  alt="next page" border=0 
        class="style3" /><span class="style3"></a></span></td><td align=LEFT 
        class="style3">
	
	    &nbsp;</td><td align=RIGHT class="style3">
	    &nbsp;</td>
<td align=LEFT class="style3">
    &nbsp;</td>
</tr>


		</table>
		</td></tr></table>
  
          <span class="style3">
  
        <!--End SECTION NAV1-->

        <!--AD2-->
          </span>
<div align="center" style="width:939px;  background:url('images/body_back.png') no-repeat bottom left; height:671px">
	&nbsp;<table border="0" width="90%">
		<tr>
			<td valign="top" width="21%" rowspan="2">
				
			    <span class="style3">&nbsp;		
			</span>		
			<table cellspacing="0" cellpadding="0" border="0" width="174">
		<tr>
			<td colspan="5" background="images/left_top.jpg" height="25" align="left" 
                class="style3">
			<font size="2" face="Interstate">&nbsp; </font>
			<font face="Arial" style="font-size: 11pt">Contact</font></td>
		</tr>
		<tr>
			<td width="1" class="infoBoxBorder" height="99"><img src="images/spacer.gif" 
                    width="1" height="99" alt="" border="0" class="style3"></td>
			<td width="10" bgcolor="#FFFFFF" height="99"><span style="font-size: 8pt">
                <img src="images/spacer.gif" width="10" height="1" alt="" border="0" 
                    class="style3"></span></td>
			<td width="148" valign="top" class="featureLinks" bgcolor="#FFFFFF" height="99">
			<p align="left">
			<span style="font-size: 8pt">
			<img src="images/spacer.gif" width="1" height="10" alt="" border="0" class="style3"></span><p align="left">
			<img src="http://vortexamerica.com/atlantic/images/arrow.jpg" width="10" border="0" 
                        height="12" class="style3"><a href="contact.html" class="style3">Contact 
			Info</a><br class="style3">
			<img src="http://vortexamerica.com/atlantic/images/arrow.jpg" width="10" border="0" 
                        height="12" class="style3"><a href="reader.aspx" class="style3">Reader 
			Info</a><br class="style3">
                    <img src="http://vortexamerica.com/atlantic/images/arrow.jpg" width="10" 
                        border="0" height="12" class="style3"><a href="join.aspx" class="style3">Employment 
			Info</a><span class="style3">&nbsp; </span> <br class="style3">
                    <img src="http://vortexamerica.com/atlantic/images/arrow.jpg" width="10" 
                        border="0" height="12" class="style3"><a href="message.html" class="style3">Message 
			Box</a><span style="font-size: 8pt"><br class="style3">
			</span>
			</td>
			<td width="10" bgcolor="#FFFFFF" height="99"><img src="images/spacer.gif" 
                    width="10" height="1" alt="" border="0" class="style3"></td>
			<td width="5" background="images/infoBox_rightEdge.gif" height="99">
                <img src="images/spacer.gif" width="5" height="1" alt="" border="0" 
                    class="style3"></td>
		</tr>
		<tr>
			<td width="1" class="infoBoxBorder" height="42"></td>
			<td width="10" bgcolor="#FFFFFF" height="42" class="style3">&nbsp;</td>
			<td width="148" valign="top" class="style3" bgcolor="#FFFFFF" height="42">
			    &nbsp;</td>
			<td width="10" bgcolor="#FFFFFF" height="42" class="style3">&nbsp;</td>
			<td width="5" background="images/infoBox_rightEdge.gif" height="42"></td>
		</tr>
		<tr>
			<td width="1" class="infoBoxBorder"><img src="images/spacer.gif" width="1" 
                    height="99" alt="" border="0" class="style3"></td>
			<td width="158" bgcolor="#FFFFFF" colspan="2" align="left">
			<span style="font-size: 8pt">
			<img src="images/spacer.gif" width="1" height="10" alt="" border="0" class="style3"><img 
                    border="0" src="images/img_equipment.jpg" width="136" height="135" 
                    class="style3"></span></td>
			<td width="10" bgcolor="#FFFFFF"><img src="images/spacer.gif" width="10" height="1" 
                    alt="" border="0" class="style3"></td>
			<td width="5" background="images/infoBox_rightEdge.gif">
                <img src="images/spacer.gif" width="5" height="1" alt="" border="0" 
                    class="style3"></td>
		</tr>
		</table>
		<table cellspacing="0" cellpadding="0" border="0">
		<tr>
			<td><img src="images/infoBox_bottomLeftCorner.gif" width="10" height="8" alt="" 
                    border="0" class="style3"></td>
			<td background="images/infoBox_bottomEdge.gif"><img src="images/spacer.gif" 
                    width="156" height="8" alt="" border="0" class="style3"></td>
			<td><img src="images/infoBox_bottomRightCorner.gif" width="10" height="8" alt="" 
                    border="0" class="style3"></td>
		</tr>
		</table>
		<br class="style3"><br class="style3"><td valign="top" rowspan="2" width="1%" 
                class="style3">
				
				&nbsp;<td valign="top" width="582" colspan="2">
				
			<p align="left" class="style3">
				
			    &nbsp;</p>
			<p align="left">
			<font face="Arial" color="#055779"><span style="font-size: 11pt">If 
			you would like to learn more about AtlanticGolf.net LLC, if you are 
			familiar with a Golf Course whose leadership you feel we should be 
			talking with, or if you have a Golf Course for which you would like 
			us to actively consider management or purchase,<br> please provide us 
			the following information.</span></font></p>
			<p class="style3">&nbsp;
			
			<div align="center">
<form id="Form1" method = "post" name = "frmemail" runat = "server" enctype="multipart/form-data" onSubmit = "return Tocheck(this)">
	<table bo width="637" height="196">
		<tr>
			<td height="196" width="319" valign="top">
			
			    <asp:Panel ID="Form" runat="server" Height="50px" Width="343px" 
                    CssClass="style3">
                    <p align="right" style="text-align: right">
                        <span style="font-size: 11pt">Email:</span>
                        <asp:TextBox ID = "txtName" Runat =server></asp:TextBox>
                    </p>
                    <p style="text-align: right">
                        <span style="font-size: 11pt">Name:</span>
                        <asp:TextBox ID="txtEmail" Runat="server"></asp:TextBox></p>
                        <p style="text-align: right">
                            <span style="font-size: 11pt">Address:</span><asp:TextBox ID="txtAddress" 
                                Runat="server"></asp:TextBox></p>
                            <p style="text-align: right">
                                <span style="font-size: 11pt">Address2:</span><asp:TextBox ID="txtAddress2" 
                                    Runat="server"></asp:TextBox></p>
                                <p style="text-align: right">
                                    <span style="font-size: 11pt">City:</span><asp:TextBox ID="txtCity" 
                                        Runat="server"></asp:TextBox></p>
                                    <p style="text-align: right">
                                        <span style="font-size: 11pt">State:</span>
                                        <asp:DropDownList id="txtState" runat="server">

    <asp:ListItem Value="">Select One</asp:ListItem>
    
    <asp:ListItem Value="AL">Alabama</asp:ListItem>

    <asp:ListItem Value="AK">Alaska</asp:ListItem>

    <asp:ListItem Value="AZ">Arizona</asp:ListItem>

    <asp:ListItem Value="AR">Arkansas</asp:ListItem>

    <asp:ListItem Value="CA">California</asp:ListItem>

    <asp:ListItem Value="CO">Colorado</asp:ListItem>

    <asp:ListItem Value="CT">Connecticut</asp:ListItem>

    <asp:ListItem Value="DC">District of Columbia</asp:ListItem>

    <asp:ListItem Value="DE">Delaware</asp:ListItem>

    <asp:ListItem Value="FL">Florida</asp:ListItem>

    <asp:ListItem Value="GA">Georgia</asp:ListItem>

    <asp:ListItem Value="HI">Hawaii</asp:ListItem>

    <asp:ListItem Value="ID">Idaho</asp:ListItem>

    <asp:ListItem Value="IL">Illinois</asp:ListItem>

    <asp:ListItem Value="IN">Indiana</asp:ListItem>

    <asp:ListItem Value="IA">Iowa</asp:ListItem>

    <asp:ListItem Value="KS">Kansas</asp:ListItem>

    <asp:ListItem Value="KY">Kentucky</asp:ListItem>

    <asp:ListItem Value="LA">Louisiana</asp:ListItem>

    <asp:ListItem Value="ME">Maine</asp:ListItem>

    <asp:ListItem Value="MD">Maryland</asp:ListItem>

    <asp:ListItem Value="MA">Massachusetts</asp:ListItem>

    <asp:ListItem Value="MI">Michigan</asp:ListItem>

    <asp:ListItem Value="MN">Minnesota</asp:ListItem>

    <asp:ListItem Value="MS">Mississippi</asp:ListItem>

    <asp:ListItem Value="MO">Missouri</asp:ListItem>

    <asp:ListItem Value="MT">Montana</asp:ListItem>

    <asp:ListItem Value="NE">Nebraska</asp:ListItem>

    <asp:ListItem Value="NV">Nevada</asp:ListItem>

    <asp:ListItem Value="NH">New Hampshire</asp:ListItem>

    <asp:ListItem Value="NJ">New Jersey</asp:ListItem>

    <asp:ListItem Value="NM">New Mexico</asp:ListItem>

    <asp:ListItem Value="NY">New York</asp:ListItem>

    <asp:ListItem Value="NC">North Carolina</asp:ListItem>

    <asp:ListItem Value="ND">North Dakota</asp:ListItem>

    <asp:ListItem Value="OH">Ohio</asp:ListItem>

    <asp:ListItem Value="OK">Oklahoma</asp:ListItem>

    <asp:ListItem Value="OR">Oregon</asp:ListItem>

    <asp:ListItem Value="PA">Pennsylvania</asp:ListItem>

    <asp:ListItem Value="RI">Rhode Island</asp:ListItem>

    <asp:ListItem Value="SC">South Carolina</asp:ListItem>

    <asp:ListItem Value="SD">South Dakota</asp:ListItem>

    <asp:ListItem Value="TN">Tennessee</asp:ListItem>

    <asp:ListItem Value="TX">Texas</asp:ListItem>

    <asp:ListItem Value="UT">Utah</asp:ListItem>

    <asp:ListItem Value="VT">Vermont</asp:ListItem>

    <asp:ListItem Value="VA">Virginia</asp:ListItem>

    <asp:ListItem Value="WA">Washington</asp:ListItem>

    <asp:ListItem Value="WV">West Virginia</asp:ListItem>

    <asp:ListItem Value="WI">Wisconsin</asp:ListItem>

    <asp:ListItem Value="WY">Wyoming</asp:ListItem>

</asp:DropDownList>
</p>
                              
                    <p style="text-align: right">
                        <span style="font-size: 11pt">Phone:</span><asp:TextBox ID="txtPhone" 
                            Runat="server"></asp:TextBox>
                    </p>
                              
                    <p style="text-align: right">
                        Attach:<input ID="txtFile" runat="server" type="file"> </input>
                        <p style="text-align: right">
                            <asp:Button ID="btnSubmit" Runat="server" OnClick="btnSubmit_Click" 
                                Text="SEND" />
                        </p>
                        <p>
                        </p>
                    </p>
                              
                </asp:Panel>


			<p align="center" style="text-align: right" class="style3">&nbsp;</td>
			<td height="196" width="318" valign="top">
			
			<p align="right" class="style3">&nbsp;<asp:Panel ID="Message" runat="server" Height="50px" 
                    
                    
                    style="z-index: 1; left: 493px; top: 521px; position: absolute; height: 50px; width: 306px" 
                    ForeColor="#CC0000" CssClass="style3">
                Thank You.&nbsp; Your Message has been sent.
                </asp:Panel>
                              
                 
                <asp:Panel ID="Details" runat="server" Height="165px" Width="125px">
                    </p __designer:mapid="13c">
                    <span class="style4">Details</span>:<asp:TextBox ID="txtDetails" Runat="server" 
                        Height="150px" Width="250px"></asp:TextBox>
                </asp:Panel>
                </span></span>
                              
            </td>
		</tr>
	</table>
	</form>
</div><td valign="top" width="1%" rowspan="2" class="style3">
				
			    &nbsp;<tr>
			<td valign="top" width="23%" align="right" class="style3">
				
			    &nbsp;<td align="left" valign="top" width="52%" class="style3">
		        &nbsp;</td>
</form></table>
	</div>        <span class="style3">        <!--END AD2-->
         <!--CONTENT-->

        <!--END AD3-->
  
          </span>
  
  <table id="nav2" class="nav2"><tr><td>
<table width="100%" id="nav3" class="navarrows">
<tr><td align=RIGHT class="style3">
	&nbsp;</td><td align=LEFT>
	<p align="center" style="text-align: center" class="style3">
	<font face="Arial" color="#000000">

Modify your code in the below way:

if (txtFile.HasFile)
{
txtFile.PostedFile.SaveAs(strdir+strfilename);
mail.Attachments.Add(new MailAttachment(strdir+strfilename));
}

Hope it will resolve your problem.

Very long long code...

I hope you haven't a problem with sending an email. As far as your code is concern I made following correction:

string strdir = "c:\\182404wf6\\temp\\";

string strfilename="";
if(txtFile.PostedFile.ContentLength!=0) {
  strfilename = Path.GetFileName(txtFile.PostedFile.FileName);
  txtFile.PostedFile.SaveAs(strdir+strfilename);
  mail.Attachments.Add(new MailAttachment(strdir+strfilename));
}
This article has been dead for over six months. Start a new discussion instead.