hear is what my code look like for my send mail page..
Maybe some one can help me, to show me how to upload attachment to this page so my vistor can send picture or text file or anything. I need it so that they can attach file. I do have a simple msdn sql database and i also use webmatix to help me design my page so please explain it straight foward and in the simplest form thank you. Also this file is in asp.net
<%@ Page Language="
VB" %>
<%@ import Namespace="System.Web.Mail" %>
<script runat="server">
Sub buttonSend_Click(sender As Object, e As EventArgs)
Dim emailMessage As MailMessage
emailMessage = New MailMessage
emailMessage.From = textFrom.Text
emailMessage.Cc = textCopy.Text
emailMessage.To = textTo.Text
emailMessage.Subject = textSubject.Text
emailMessage.Body = textMessage.Text
SmtpMail.SmtpServer="localhost"
Try
SmtpMail.Send(emailMessage)
labelStatus.Text = "Message sent!"
buttonSend.Enabled = False
Catch ex As Exception
labelStatus.Text = "Unable to send e-mail message!"
End Try
End Sub
Sub buttonNewMessage_Click(sender As Object, e As EventArgs)
textFrom.Text = ""
textCopy.Text = ""
textTo.Text = ""
textSubject.Text = ""
textMessage.Text = ""
buttonSend.Enabled = True
labelStatus.Text = ""
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<h1>Pic Media E-mail System!
</h1>
<p>
By: Anthony Szabo
</p>
<p>
</p>
<h1> Send an E-mail Message
</h1>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
<strong>Send a e-mail to anyone. You just need your e-mail address to send the e-mail
to anyone you like. You don't need to sign up for any service's, it easy as 123! All
you do is enter your e-mail, if you want a carbon copy you fill in the CC:. If
not you enter the person e-mail you are sending it to and the subject and message
and hit send your done.</strong>
</p>
<p>
<strong>From:
<asp:TextBox id="textFrom" runat="server"></asp:TextBox>
</strong><strong>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ControlToValidate="textFrom" ErrorMessage="You must enter you e-mail address!"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server" ControlToValidate="textFrom" ErrorMessage="Invaild e-mail address!" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
</strong>
</p>
<p>
Cc:
<asp:TextBox id="textCopy" runat="server"></asp:TextBox>
</p>
<p>
<strong>To:
<asp:TextBox id="textTo" runat="server" Width="157px"></asp:TextBox>
</strong><strong>
<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ControlToValidate="textTo" ErrorMessage="You must enter a recipient!"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="RegularExpressionValidator2" runat="server" ControlToValidate="textTo" ErrorMessage="Invaild e-mail address!" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
</strong>
</p>
<p>
<strong>Subject:
<asp:TextBox id="textSubject" runat="server" Width="299px"></asp:TextBox>
</strong>
</p>
<p>
<strong>Message:<br />
</strong><strong>
<asp:TextBox id="textMessage" runat="server" Width="476px" Height="116px" TextMode="MultiLine"></asp:TextBox>
</strong>
</p>
<p>
<strong>
<asp:RequiredFieldValidator id="RequiredFieldValidator3" runat="server" ControlToValidate="textMessage" ErrorMessage="You must enter a message!"></asp:RequiredFieldValidator>
</strong>
</p>
<p>
<asp:Button id="buttonSend" onclick="buttonSend_Click" runat="server" Text="Send"></asp:Button>
<asp:Button id="buttonNewMessage" onclick="buttonNewMessage_Click" runat="server" Text="New Message"></asp:Button>
</p>
<p>
<asp:Label id="labelStatus" runat="server" font-bold="True" forecolor="Red"></asp:Label>
<br />
</p>
<h1>
<br />
</h1>
</form>
</body>
</html>