Advertisement

05.13.2008 at 06:22AM PDT, ID: 23397616
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Adding attachment to email from form

Tags: asp.net 2.0, Internet Explorer 7, Form Attachment sent thru email
How can I add an attachment that a user adds thru a form to an email from the esisting code.  I've tried several ways but I just can't get it too work.  I'm new to this so I'm sure I'm missing something.  This is the entire code I'm using....
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
<%@ import Namespace="System.Web.UI.HTMLControls" %>
<%@ import Namespace="System.Web.Mail" %>
<script runat="server">
 
    'Declaring variables
    Dim strname As String
    Dim stremail As String
    Dim strcurrent As String
    Dim strschool As String
    Dim strapply As String
    Dim strposition As String
    Dim strat As String
    Dim strpref As String
    Dim strnotes As String
    Dim strtext As String
    
Sub Page_Load(sender as Object, e as EventArgs)
	If Not Page.IsPostBack then
		pnlForm.Visible = True
	End If
 
End Sub
    
Sub btnSubmit_Click(sender as Object, e as EventArgs)
	'Check validation controls in non-IE browsers
	If Page.IsValid then
	'Get input from the form and assign it to script variables
	stremail = Trim(Request.form("user_email"))
	if stremail <> "" then
		stremail = stremail
	end if
 
            strname = Request.Form("user_name")
            stremail = Request.Form("user_email")
            strcurrent = Request.Form("user_current")
            strschool = Request.Form("user_school")
            strapply = Request.Form("user_apply")
            strposition = Request.Form("user_position")
            strat = Request.Form("user_at")
            strpref = Request.Form("user_pref")
            strnotes = Request.Form("user_notes")
            'End if
 
            strtext = "Teacher Name: " & strname & "<br />" & _
              "<br />" & _
              "Email Address: " & stremail & "<br />" & _
              "<br />" & _
              "Current Position: " & strcurrent & "<br />" & _
              "<br />" & _
              "Present School: " & strschool & "<br />" & _
              "<br />" & _
              "Applying For: " & strapply & "<br />" & _
              "<br />" & _
              "Position Number: " & strposition & "<br />" & _
              "<br />" & _
              "School Position At: " & strat & "<br />" & _
              "<br />" & _
              "Order of Preference " & strpref & "<br />" & _
              "<br />" & _
              "Additional Notes: " & strnotes & "<br />"
 
Dim objEmail as New MailMessage()
	    With objEmail
	      .BodyFormat = MailFormat.html
                .To = "emailto@email.ca"
		.cc = stremail
                .From = "Posting_1@email.ca"
	      .Headers.Add("Reply-To", stremail)
                .Subject = strname & " applying for position" & strposition & " at " & strat
                .Body = strtext
                
 
 
 
            End With
	   SmtpMail.SmtpServer  = "server.ca" 
	try
		SmtpMail.Send(objEMail)
	catch exc as Exception
		lblErrMsg.Text = ("E-mail was not sent because of a server error: " + exc.ToString())
	End Try
    
	pnlForm.Visible = False
	
	'Optionally, you can preserve line breaks in submitted question text
	'If you specify MailFormat.html, above, you could use this function to keep line breaks in the message
	'as we are doing here in the HTML acknowledgment display:
	stremail = replace(stremail,vbNewline,"<br />")
     
            lblAck.Text = ("<h3>Thank you for using the District 6 Posting Form for Posting # 1!</h3><br />" & _
          "Your information was submitted as follows:<br />" & _
          "Teacher Name: " & strname & "<br />" & _
          "<br />" & _
          "Email Address: " & stremail & "<br />" & _
          "<br />" & _
          "Current Position: " & strcurrent & "<br />" & _
          "<br />" & _
          "Present School: " & strschool & "<br />" & _
          "<br />" & _
          "Applying For: " & strapply & "<br />" & _
          "<br />" & _
          "Position Number: " & strposition & "<br />" & _
          "<br />" & _
          "School Position At: " & strat & "<br />" & _
          "<br />" & _
          "Order of Preference " & strpref & "<br />" & _
          "<br />" & _
          "Additional Notes: " & strnotes & "<br />" & _
          "<a href='javascript:history.go(-1)'>Back to Filled in Form</a> &nbsp;" & _
          "<a href='posting_1.aspx'>Back to Blank Form</a>")
 
End If
End Sub
 
    Protected Sub user_date_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
 
    End Sub
 
    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
 
    End Sub
 
    Protected Sub DropDownList1_SelectedIndexChanged1(ByVal sender As Object, ByVal e As System.EventArgs)
 
    End Sub
 
    Protected Sub DropDownList1_SelectedIndexChanged2(ByVal sender As Object, ByVal e As System.EventArgs)
 
    End Sub
</script>
 
<!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" xml:lang="en" lang="en">
 
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Posting Response Form for Posting # 1</title>
<style type="text/css">
body {margin: 0; background-color: #fff; font-family: georgia, serif; }
h1 {font-size: 140%; margin-top: 1em;}
#main {margin-left: 10%;}
.req {font-weight: bold; color: #900;}
    .style1
    {
        font-weight: bold;
        color: #0033CC;
    }
    .style2
    {
        font-family: Verdana;
    }
    .style3
    {
        text-align: left;
        width: 158px;
    }
    .style4
    {
        width: 158px;
    }
</style>
</head>
 
 
<body id="subj">
<div id="main">
  <p align="center" class="style1"><span class="style2">School District 6</p>
  <p align="center" class="style1">Posting Response Form for Posting # 1 </span> </p>
  <form runat="server">
 <asp:Panel id="pnlForm" runat="server">
   <table width="782" border="0">
     <tbody>
       <tr>
         <td align="right" class="style4" style="text-align: left">Teacher Name:</td>
	    <td width="570">
            <asp:textbox id="user_name" runat="server" size="20" 
                ontextchanged="user_date_TextChanged" BackColor="#FFFFCC" Width="195px" 
                Height="20px" /></td>
	    </tr>
       <tr>
         <td align="right" class="style4" style="text-align: left">Email Address:</td>
		  <td><asp:textbox id="user_email" runat="server" size="20" BackColor="#FFFFCC" 
                  Width="195px" Height="20px" /></td>
	  </tr>
       <tr>
         <td class="style3">Current Position:</td>
		  <td><asp:textbox id="user_current" runat="server" size="20" BackColor="#FFFFCC" 
                  Width="194px" Height="20px" /></td>
	  </tr>
       <tr>
         <td align="right" class="style4" style="text-align: left">Current School: </div></td>
		  <td>
              <asp:DropDownList ID="user_school" runat="server" Height="27px" Width="404px" 
                  BackColor="#FFFFCC">
                  <asp:ListItem>Apohaqui Elementary</asp:ListItem>
        <asp:ListItem>Belleisle Elementary</asp:ListItem>
        <asp:ListItem>Belleisle Regional</asp:ListItem>
        <asp:ListItem>Dr Leatherbarrow</asp:ListItem>
        <asp:ListItem>Fairvale Elementary</asp:ListItem>
        <asp:ListItem>Hammond River Elementary</asp:ListItem>
        <asp:ListItem>Hampton Elementary</asp:ListItem>
        <asp:ListItem>Hampton High</asp:ListItem>
        <asp:ListItem>Hampton Middle</asp:ListItem>
        <asp:ListItem>Harry Miller Middle</asp:ListItem>
        <asp:ListItem>Kennebecasis Park Elementary</asp:ListItem>
        <asp:ListItem>Kennebecasis Valley High</asp:ListItem>
        <asp:ListItem>Lakefield Elementary</asp:ListItem>
        <asp:ListItem>MacDonald Consolidated</asp:ListItem>
        <asp:ListItem>Norton Elementary</asp:ListItem>
        <asp:ListItem>PALS - Hampton</asp:ListItem>
        <asp:ListItem>PALS - Sussex</asp:ListItem>
        <asp:ListItem>Quispamsis Elementary</asp:ListItem>
        <asp:ListItem>Quispamsis Middle</asp:ListItem>
        <asp:ListItem>Rothesay Elementary</asp:ListItem>
        <asp:ListItem>Rothesay High</asp:ListItem>
        <asp:ListItem>Rothesay Park</asp:ListItem>
        <asp:ListItem>Sussex Corner Elementary</asp:ListItem>
        <asp:ListItem>Sussex Elementary</asp:ListItem>
        <asp:ListItem>Sussex Middle</asp:ListItem>
        <asp:ListItem>Sussex Regional High</asp:ListItem>
              </asp:DropDownList>
           </td>
	  </tr>
	  </tr __designer:mapid="20">
       <tr>
        <td align="right" class="style4" style="text-align: left">I am applying for:</td>
		  <td>
              <asp:TextBox ID="user_apply" runat="server" BackColor="#FFFFCC" size="20" 
                  Width="191px" Height="20px" />
              &nbsp;Position, Number
              <asp:TextBox ID="user_position" runat="server" BackColor="#FFFFCC"></asp:TextBox>
           </td>
	  </tr>
         <tr>
             <td valign="top" class="style3">
                 Position is at:
                 <br />
                 </td>
             <td>
                 <asp:DropDownList ID="user_at" runat="server" Height="28px" Width="404px" 
                     BackColor="#FFFFCC">
                     <asp:ListItem>Apohaqui Elementary</asp:ListItem>
        <asp:ListItem>Belleisle Elementary</asp:ListItem>
        <asp:ListItem>Belleisle Regional</asp:ListItem>
        <asp:ListItem>Dr Leatherbarrow</asp:ListItem>
        <asp:ListItem>Fairvale Elementary</asp:ListItem>
        <asp:ListItem>Hammond River Elementary</asp:ListItem>
        <asp:ListItem>Hampton Elementary</asp:ListItem>
        <asp:ListItem>Hampton High</asp:ListItem>
        <asp:ListItem>Hampton Middle</asp:ListItem>
        <asp:ListItem>Harry Miller Middle</asp:ListItem>
        <asp:ListItem>Kennebecasis Park Elementary</asp:ListItem>
        <asp:ListItem>Kennebecasis Valley High</asp:ListItem>
        <asp:ListItem>Lakefield Elementary</asp:ListItem>
        <asp:ListItem>MacDonald Consolidated</asp:ListItem>
        <asp:ListItem>Norton Elementary</asp:ListItem>
        <asp:ListItem>PALS - Hampton</asp:ListItem>
        <asp:ListItem>PALS - Sussex</asp:ListItem>
        <asp:ListItem>Quispamsis Elementary</asp:ListItem>
        <asp:ListItem>Quispamsis Middle</asp:ListItem>
        <asp:ListItem>Rothesay Elementary</asp:ListItem>
        <asp:ListItem>Rothesay High</asp:ListItem>
        <asp:ListItem>Rothesay Park</asp:ListItem>
        <asp:ListItem>Sussex Corner Elementary</asp:ListItem>
        <asp:ListItem>Sussex Elementary</asp:ListItem>
        <asp:ListItem>Sussex Middle</asp:ListItem>
        <asp:ListItem>Sussex Regional High</asp:ListItem>
                 </asp:DropDownList>
             </td>
         </tr>
         <tr>
             <td align="right" class="style4" style="text-align: left">
                 Order of Preference:</td>
             <td>
                 <asp:TextBox ID="user_pref" runat="server" BackColor="#FFFFCC" size="20" />
             </td>
         </tr>
         <tr>
             <td align="right" colspan="2" style="text-align: left">
                 <br />
                 Please complete and submit this form before 12:00 Noon on Friday, May 16, 2008<br />
                 <br />
                 NOTE: If applying for more than one posting, please submit a seperate form and 
                 indicate your preference of this position.<br />
                 <br />
                 If applying for positions in Resource &amp; Methods, Guidance, Music, Art, Phys Ed 
                 or French, please indicate below your qualifications for the position, e.g. 
                 Degree, Course Work, FSL Proficiency Level.<br />
                 <br />
                 <asp:TextBox ID="user_notes" runat="server" Height="241px" Width="772px" 
                     BackColor="#FFFFCC"></asp:TextBox>
            </td>
         </tr>
         <tr>
             <td align="right" class="style4">
                 <asp:FileUpload ID="FileUpload1" runat="server" />
             </td>
             <td>
                 If attaching Resume or Supporting document, inlcude here.</td>
         </tr>
         <tr>
             <td class="style4">
                 &nbsp;</td>
             <td height="40">
                 <asp:Button ID="btnSubmit" runat="server" onclick="btnSubmit_Click" 
                     text="Submit" />
                 &nbsp;<input runat="server" name="btnReset" type="reset" value="Reset" />
             </td>
         </tr>
         <tr>
             <td colspan="2">
                 <asp:Label ID="lblErrMsg" Runat="server"></asp:Label>
             </td>
         </tr>
         </tr>
       </tbody>
  </table>
  </asp:Panel>
 <asp:Label id="lblAck" Runat="server"></asp:Label>
  </form>    
</div> 
 
</body>
</html>
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: Jamie_Tait
Solution Provided By: DarkoLord
Participating Experts: 1
Solution Grade: A
Views: 0
Translate:
Loading Advertisement...
05.13.2008 at 06:36AM PDT, ID: 21554878

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 06:43AM PDT, ID: 21554933

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 06:59AM PDT, ID: 21555071

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 07:04AM PDT, ID: 21555113

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 07:08AM PDT, ID: 21555159

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 09:11AM PDT, ID: 21556487

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 11:41AM PDT, ID: 21557979

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.13.2008 at 01:23PM PDT, ID: 21558929

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2008 at 05:19AM PDT, ID: 21563279

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2008 at 06:20AM PDT, ID: 21563821

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2008 at 06:22AM PDT, ID: 21563836

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2008 at 06:37AM PDT, ID: 21563988

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.14.2008 at 07:36AM PDT, ID: 21564663

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.15.2008 at 07:34AM PDT, ID: 21574070

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.16.2008 at 12:58PM PDT, ID: 21585929

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.13.2008 at 06:36AM PDT, ID: 21554878

Rank: Wizard

Hi, try something like this:
1:
2:
3:
Dim fileName As String = Path.GetFileName(FileUpload1.PostedFile.FileName)
Dim myAttachment As New Attachment(FileUpload1.FileContent, fileName)
objEmail.Attachments.Add(myAttachment)
Open in New Window
 
05.13.2008 at 06:43AM PDT, ID: 21554933

Rank: Wizard

Note that the Path class is in System.IO namespace
 
05.13.2008 at 06:59AM PDT, ID: 21555071
OK I did mention I was new to this right... where does this fit in?

I have to declare the System.IO namespace at the beginning...

Does line 1 and 2 do under the variables? and where does the objemail go?

I've added the lines where I think they go but no luck...
 
05.13.2008 at 07:04AM PDT, ID: 21555113

Rank: Wizard

The code part for creating message should look like this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Dim objEmail as New MailMessage()
With objEmail
  .BodyFormat = MailFormat.html
  .To = "emailto@email.ca"
  .cc = stremail
  .From = "Posting_1@email.ca"
  .Headers.Add("Reply-To", stremail)
  .Subject = strname & " applying for position" & strposition & " at " & strat
  .Body = strtext
  Dim fileName As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName)
  Dim myAttachment As New Attachment(FileUpload1.FileContent, fileName)
  .Attachments.Add(myAttachment)
End With
Open in New Window
 
05.13.2008 at 07:08AM PDT, ID: 21555159
Now I'm getting this error... thanks for your help It's hugely appreciated!


Compiler Error Message: BC30561: 'MailMessage' is ambiguous, imported from the namespaces or types 'System.Web.Mail, System.Net.Mail'.

Source Error:

 

Line 63:               "Additional Notes: " & strnotes & "<br />"
Line 64:
Line 65:             Dim objEmail As New MailMessage()
Line 66:             With objEmail
Line 67:                 .BodyFormat = MailFormat.Html
 

 
05.13.2008 at 09:11AM PDT, ID: 21556487

Rank: Wizard

The System.Web.Mail class is deprecated. Replace the

<%@ import Namespace="System.Web.Mail" %>

with

<%@ import Namespace="System.Net.Mail" %>
 
05.13.2008 at 11:41AM PDT, ID: 21557979
I did that but now it doesn't recognise the .bodyformat or .to or .cc says it's not a member.  

 
05.13.2008 at 01:23PM PDT, ID: 21558929

Rank: Wizard

Sorry,  try this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
        Dim objEmail As New MailMessage()
        With objEmail
            .IsBodyHtml = True
            .To.Add(New MailAddress("mailto@email.ca"))
            .CC.Add(New MailAddress(stremail))
            .CC = stremail
            .From = New MailAddress("Posting_1@email.ca")
            .Headers.Add("Reply-To", stremail)
            .Subject = strname & " applying for position" & strposition & " at " & strat
            .Body = strtext
            Dim fileName As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName)
            Dim myAttachment As New Attachment(FileUpload1.FileContent, fileName)
            .Attachments.Add(myAttachment)
        End With
Open in New Window
 
05.14.2008 at 05:19AM PDT, ID: 21563279
OK It's awesome that your working thru this with me... I really appreciate it!

This is what I have now... when trying to load the page.

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: BC30188: Declaration expected.

Source Error:

 

Line 90:     'If you specify MailFormat.html, above, you could use this function to keep line breaks in the message
Line 91:     'as we are doing here in the HTML acknowledgment display:
Line 92:     stremail = replace(stremail,vbNewline,"<br />")
Line 93:      
Line 94:             lblAck.Text = ("<h3>Thank you for using the District 6 Posting Form for Posting # 1!</h3><br />" & _
 

Source File: E:\ped\DT06\Posting1.aspx    Line: 92



Show Detailed Compiler Output:


c:\winnt\system32\inetsrv> "C:\WINNT\Microsoft.NET\Framework\v2.0.50727\vbc.exe" /t:library /utf8output /R:"C:\WINNT\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINNT\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINNT\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /R:"C:\WINNT\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\WINNT\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /out:"C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dt06\05688e15\21acc15\App_Web_dva-jarh.dll" /debug- /win32resource:"C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dt06\05688e15\21acc15\dva-jarh.res" /define:_MYTYPE=\"Web\" /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Specialized,System.Configuration,System.Text,System.Text.RegularExpressions,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  "C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dt06\05688e15\21acc15\App_Web_dva-jarh.0.vb" "C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dt06\05688e15\21acc15\App_Web_dva-jarh.1.vb" "C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dt06\05688e15\21acc15\App_Web_dva-jarh.2.vb" "C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dt06\05688e15\21acc15\App_Web_dva-jarh.3.vb" "C:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dt06\05688e15\21acc15\App_Web_dva-jarh.4.vb"


Microsoft (R) Visual Basic Compiler version 8.0.50727.1433
for Microsoft (R) .NET Framework version 2.0.50727.1433
Copyright (c) Microsoft Corporation.  All rights reserved.

E:\ped\DT06\Posting1.aspx(92) : error BC30188: Declaration expected.

    stremail = replace(stremail,vbNewline,"<br />")
    ~~~~~~~~                                      
E:\ped\DT06\Posting1.aspx(94) : error BC30188: Declaration expected.

            lblAck.Text = ("<h3>Thank you for using the District 6 Posting Form for Posting # 1!</h3><br />" & _
            ~~~~~~                                                                                              
E:\ped\DT06\Posting1.aspx(116) : error BC30087: 'End If' must be preceded by a matching 'If'.

End If
~~~~~~
E:\ped\DT06\Posting1.aspx(117) : error BC30429: 'End Sub' must be preceded by a matching 'Sub'.

End Sub
~~~~~~~
E:\ped\DT06\Posting_1.aspx(62) : warning BC40000: 'System.Web.Mail.MailMessage' is obsolete: 'The recommended alternative is System.Net.Mail.MailMessage. http://go.microsoft.com/fwlink/?linkid=14202'

Dim objEmail as New MailMessage()
                    ~~~~~~~~~~~  
E:\ped\DT06\Posting_1.aspx(64) : warning BC40000: 'System.Web.Mail.MailFormat' is obsolete: 'The recommended alternative is System.Net.Mail.MailMessage.IsBodyHtml. http://go.microsoft.com/fwlink/?linkid=14202'

          .BodyFormat = MailFormat.html
                        ~~~~~~~~~~    
E:\ped\DT06\Posting_1.aspx(73) : warning BC40000: 'System.Web.Mail.SmtpMail' is obsolete: 'The recommended alternative is System.Net.Mail.SmtpClient. http://go.microsoft.com/fwlink/?linkid=14202'

       SmtpMail.SmtpServer  = "mail.nbed.nb.ca"
       ~~~~~~~~                                
E:\ped\DT06\Posting_1.aspx(75) : warning BC40000: 'System.Web.Mail.SmtpMail' is obsolete: 'The recommended alternative is System.Net.Mail.SmtpClient. http://go.microsoft.com/fwlink/?linkid=14202'

        SmtpMail.Send(objEMail)
        ~~~~~~~~              
E:\ped\DT06\form.aspx(100) : warning BC40000: 'System.Web.Mail.MailMessage' is obsolete: 'The recommended alternative is System.Net.Mail.MailMessage. http://go.microsoft.com/fwlink/?linkid=14202'

Dim objEmail as New MailMessage()
                    ~~~~~~~~~~~  
E:\ped\DT06\form.aspx(102) : warning BC40000: 'System.Web.Mail.MailFormat' is obsolete: 'The recommended alternative is System.Net.Mail.MailMessage.IsBodyHtml. http://go.microsoft.com/fwlink/?linkid=14202'

          .BodyFormat = MailFormat.html
                        ~~~~~~~~~~    
E:\ped\DT06\form.aspx(110) : warning BC40000: 'System.Web.Mail.SmtpMail' is obsolete: 'The recommended alternative is System.Net.Mail.SmtpClient. http://go.microsoft.com/fwlink/?linkid=14202'

       SmtpMail.SmtpServer  = "mail.nbed.nb.ca"
       ~~~~~~~~                                
E:\ped\DT06\form.aspx(112) : warning BC40000: 'System.Web.Mail.SmtpMail' is obsolete: 'The recommended alternative is System.Net.Mail.SmtpClient. http://go.microsoft.com/fwlink/?linkid=14202'

        SmtpMail.Send(objEMail)
        ~~~~~~~~              

 




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
 
05.14.2008 at 06:20AM PDT, ID: 21563821

Rank: Wizard

Can you please post the entire code you have now?
 
05.14.2008 at 06:22AM PDT, ID: 21563836
<%@ import Namespace="System.Web.UI.HTMLControls" %>
<%@ Import Namespace="System.Net.Mail" %>
<%@ import Namespace="System.IO" %>

<script runat="server">

    'Declaring variables
    Dim strname As String
    Dim stremail As String
    Dim strcurrent As String
    Dim strschool As String
    Dim strapply As String
    Dim strposition As String
    Dim strat As String
    Dim strpref As String
    Dim strnotes As String
    Dim strtext As String
   
Sub Page_Load(sender as Object, e as EventArgs)
      If Not Page.IsPostBack then
            pnlForm.Visible = True
      End If

End Sub
   
Sub btnSubmit_Click(sender as Object, e as EventArgs)
      'Check validation controls in non-IE browsers
        If Page.IsValid Then

        End If
      'Get input from the form and assign it to script variables
      stremail = Trim(Request.form("user_email"))
      if stremail <> "" then
            stremail = stremail
      end if

            strname = Request.Form("user_name")
            stremail = Request.Form("user_email")
            strcurrent = Request.Form("user_current")
            strschool = Request.Form("user_school")
            strapply = Request.Form("user_apply")
            strposition = Request.Form("user_position")
            strat = Request.Form("user_at")
            strpref = Request.Form("user_pref")
            strnotes = Request.Form("user_notes")
            'End if

            strtext = "Teacher Name: " & strname & "<br />" & _
              "<br />" & _
              "Email Address: " & stremail & "<br />" & _
              "<br />" & _
              "Current Position: " & strcurrent & "<br />" & _
              "<br />" & _
              "Present School: " & strschool & "<br />" & _
              "<br />" & _
              "Applying For: " & strapply & "<br />" & _
              "<br />" & _
              "Position Number: " & strposition & "<br />" & _
              "<br />" & _
              "School Position At: " & strat & "<br />" & _
              "<br />" & _
              "Order of Preference " & strpref & "<br />" & _
              "<br />" & _
              "Additional Notes: " & strnotes & "<br />"

        Dim objEmail As New MailMessage()
        With objEmail
            .IsBodyHtml = True
            .To.Add(New MailAddress("mailto@email.ca"))
            .CC.Add(New MailAddress(stremail))
            .From = New MailAddress("Posting_1@email.ca")
            .Headers.Add("Reply-To", stremail)
            .Subject = strname & " applying for position" & strposition & " at " & strat
            .Body = strtext
            Dim fileName As String = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName)
            Dim myAttachment As New Attachment(FileUpload1.FileContent, fileName)
            .Attachments.Add(myAttachment)
        End With
 
            Dim mSmtpClient As New SmtpClient()
            ' Send the mail message
            mSmtpClient.Send(objEmail)
    End Sub
    'End Class

   
    '      pnlForm.Visible = False
      
    'Optionally, you can preserve line breaks in submitted question text
    'If you specify MailFormat.html, above, you could use this function to keep line breaks in the message
    'as we are doing here in the HTML acknowledgment display:
    stremail = replace(stremail,vbNewline,"<br />")
     
            lblAck.Text = ("<h3>Thank you for using the District 6 Posting Form for Posting # 1!</h3><br />" & _
          "Your information was submitted as follows:<br />" & _
          "Teacher Name: " & strname & "<br />" & _
          "<br />" & _
          "Email Address: " & stremail & "<br />" & _
          "<br />" & _
          "Current Position: " & strcurrent & "<br />" & _
          "<br />" & _
          "Present School: " & strschool & "<br />" & _
          "<br />" & _
          "Applying For: " & strapply & "<br />" & _
          "<br />" & _
          "Position Number: " & strposition & "<br />" & _
          "<br />" & _
          "School Position At: " & strat & "<br />" & _
          "<br />" & _
          "Order of Preference " & strpref & "<br />" & _
          "<br />" & _
          "Additional Notes: " & strnotes & "<br />" & _
          "<a href='javascript:history.go(-1)'>Back to Filled in Form</a> &nbsp;" & _
          "<a href='posting_1.aspx'>Back to Blank Form</a>")

End If
End Sub

    Protected Sub user_date_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged1(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged2(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub
</script>

<!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" xml:lang="en" lang="en">

<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Posting Response Form for Posting # 1</title>
<style type="text/css">
body {margin: 0; background-color: #fff; font-family: georgia, serif; }
h1 {font-size: 140%; margin-top: 1em;}
#main {margin-left: 10%;}
.req {font-weight: bold; color: #900;}
    .style1
    {
        font-weight: bold;
        color: #0033CC;
    }
    .style2
    {
        font-family: Verdana;
    }
    .style3
    {
        text-align: left;
        width: 158px;
    }
    .style4
    {
        width: 158px;
    }
</style>
</head>


<body id="subj">
<div id="main">
  <p align="center" class="style1"><span class="style2">School District 6</p>
  <p align="center" class="style1">Posting Response Form for Posting # 1 </span> </p>
  <form runat="server">
 <asp:Panel id="pnlForm" runat="server">
   <table width="782" border="0">
     <tbody>
       <tr>
         <td align="right" class="style4" style="text-align: left">Teacher Name:</td>
          <td width="570">
            <asp:textbox id="user_name" runat="server" size="20"
                ontextchanged="user_date_TextChanged" BackColor="#FFFFCC" Width="195px"
                Height="20px" /></td>
          </tr>
       <tr>
         <td align="right" class="style4" style="text-align: left">Email Address:</td>
              <td><asp:textbox id="user_email" runat="server" size="20" BackColor="#FFFFCC"
                  Width="195px" Height="20px" /></td>
        </tr>
       <tr>
         <td class="style3">Current Position:</td>
              <td><asp:textbox id="user_current" runat="server" size="20" BackColor="#FFFFCC"
                  Width="194px" Height="20px" /></td>
        </tr>
       <tr>
         <td align="right" class="style4" style="text-align: left">Current School: </div></td>
              <td>
              <asp:DropDownList ID="user_school" runat="server" Height="27px" Width="404px"
                  BackColor="#FFFFCC">
                  <asp:ListItem>Apohaqui Elementary</asp:ListItem>
        <asp:ListItem>Belleisle Elementary</asp:ListItem>
        <asp:ListItem>Belleisle Regional</asp:ListItem>
        <asp:ListItem>Dr Leatherbarrow</asp:ListItem>
        <asp:ListItem>Fairvale Elementary</asp:ListItem>
        <asp:ListItem>Hammond River Elementary</asp:ListItem>
        <asp:ListItem>Hampton Elementary</asp:ListItem>
        <asp:ListItem>Hampton High</asp:ListItem>
        <asp:ListItem>Hampton Middle</asp:ListItem>
        <asp:ListItem>Harry Miller Middle</asp:ListItem>
        <asp:ListItem>Kennebecasis Park Elementary</asp:ListItem>
        <asp:ListItem>Kennebecasis Valley High</asp:ListItem>
        <asp:ListItem>Lakefield Elementary</asp:ListItem>
        <asp:ListItem>MacDonald Consolidated</asp:ListItem>
        <asp:ListItem>Norton Elementary</asp:ListItem>
        <asp:ListItem>PALS - Hampton</asp:ListItem>
        <asp:ListItem>PALS - Sussex</asp:ListItem>
        <asp:ListItem>Quispamsis Elementary</asp:ListItem