Print Page | Close Window

Attach file to site originated email

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=1677
Printed Date: 28 March 2026 at 9:41pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Attach file to site originated email
Posted By: Forestinternet
Subject: Attach file to site originated email
Date Posted: 08 April 2003 at 3:38am

I need to produce a site that can allow people to fill in a form with their details and then attach a file from their computer and send it with the email containing their details.

I know how to produce and send the form with asp, but am not sure to produce a Browse button that will select a file and attach it to the email sent from the site.

I understand that CDONTS and/or JMAIL may be involved but a point in the right direction will help me.

Thanks.



-------------
Laurence, Forest Internet



Replies:
Posted By: xdotnet
Date Posted: 08 April 2003 at 6:05am

The MailMessage Class allow you to send email with attachment

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebmailmailmessageclasstopic.asp - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebmailmailmessageclasstopic.asp



Posted By: Forestinternet
Date Posted: 09 April 2003 at 4:09am

Thanks!

I wish I understood what I am looking at on this link!

Can somebody give me some pointers to produce a Browse button that will select a file and attach it to the email sent from a site.

Thanks



Posted By: MorningZ
Date Posted: 09 April 2003 at 6:27am
if they are clicking a "browse" button on your site, then they are not using email at that point, they are using a web browser....

you seem to have two methods of delivery mixed up

and are you using "ASP Classic" or ASP.NET, your first post doesn't make it clear

-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: karp13
Date Posted: 09 April 2003 at 7:13am

If you want the person to be able to attach a file that resides on thier local computer you would need to create an upload app and have the file uploaded to your webservers file system and then have the email app grab it from there and send it out.  You would of course want to delete the file from your servers file system afterwards. 

As far as setting up the browse button in asp.net you would use the HtmlInputFile control.

I would start http://samples.gotdotnet.com/quickstart/aspplus/samples/webforms/ctrlref/htmlctrl/HtmlInputFile/doc_inputfile.aspx - here  also go to http://www.asp.net - www.asp.net and search the forums. 

Then you would just need to wrap the upload and email together. 

Good luck



Posted By: xdotnet
Date Posted: 09 April 2003 at 1:21pm

the link i'v give you give info about the MailMessage Class. One of the property of that class is Attachments.

this is ASP.NET Discussion Forum and using ASP.NET, you need that class to send email with attachment.

for the browse button, like karp13 said, you will need to use the HtmlInputFile Class

info for that class + code sample can be found in the link below:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuihtmlcontrolshtmlinputfileclasstopic.asp - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuihtmlcontrolshtmlinputfileclasstopic.asp

I hope you understand what is a class  

 



Posted By: Forestinternet
Date Posted: 12 April 2003 at 4:28am

Thanks people      I'll have a look at what you suggest.
I understand the bit about browsing - I can create a browse button in Dreamweaver to identify the file to send.
I also see that the attached file needs to be sent to the server for onward transmission to the recipient.
All I have to do now is work out how to do that!
I think it should be a fairly simple application, the code for sites that do it doesn't seem complicated.
And no, I'm not sure I understand what a "class" is - but I will find out!
Any further "plain english" help will be appreciated but at least now you guys have pointed me in the right direction - thanks 



-------------
Laurence, Forest Internet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net