|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Ok
Im very new to asp and programming so excuse me for sounding like a thickkie! ok heres me following code from an html form:: <form name="form1" method="post" action="mailto:abigailc@.....co.uk"> <p>Your name::</p> <p> <input name="textfield" type="text" size="40" maxlength="20"> </p> <p>Email address::</p> <p> <input name="textfield2" type="text" size="40" maxlength="20"> </form> ** you get the idea.... anyway, ive put in my works email address for the recipent of the form, but when I receive the form from the site, i get an unknow file form, and my email screen is blank?? Is there any asp/vb code that can show the details on my screen, or convert the details in the form into a word doc?? Also, could i add an attachment button to my form that allows people to add attachments with the form?? Please help, im cluless... xxxxxxxxx |
|
#2
|
|||
|
|||
|
---BEGIN QUOTE---
... i get an unknow file form, and my email screen is blank?? ---END QUOTE--- What's an email screen is blank ? Do you mean that your email has nothing in it? that its blank? the email that is! ---BEGIN QUOTE--- Is there any asp/vb code that can show the details on my screen, or convert the details in the form into a word doc?? ---END QUOTE--- What do you mean by show the details on my screen ? Then you ask convert the details in the form into a word doc. What is it you want exactly? Seems like your asking too many questions at the same time. ---BEGIN QUOTE--- Also, could i add an attachment button to my form that allows people to add attachments with the form?? ---END QUOTE--- Humm... Ok let's start from the beginning shall we! 1) You have a <form>...</form> that once submitted, you would like to receive an email with the information entered in the/your <form>...</form> Is that correct? 2) How would you like to receive that email? Would you like to receive the content of your <form>...</form> inside the *body* of the email OR Would you like to take the content of your <form>...</form>, create a .doc(WORD) document and *then* attach this .doc to your email? These are two different things and the approaches are different(one has more code) As for your button that you would like to add so that *users* can browse for a file on *their* computer so that they can attach it to the email is yet another thing/approach. To do that, you'll need what we call an *upload* component. Its a component that you register on your server(the one holding your .asp pages) that enables *users* to upload(send a file) to the server. Then you take that file and send an email with it(or attach that file as an attachment). Always assume that the user is somewhere in Hawaii and that your server(web server) is somewhere in Hong Kong. Now how can a *user* send a file from his computer(Hawaii) to the web server(Hong Kong) ? That's why you need an upload component that enables you the programmer to code such a thing. Now, you *can* create your own upload component using VB for example OR simply buy one for like 35$ with code example! I'd go with the 35$ personally save time and the components are reliable. Oh but wait a second...maybe you're hosting your web site at some company and *that* company doesn't/won't allow you to use third party components. Make of that *before* you start coding anything. Now back to your intial problem...the email part. If all you want is to send an email with the content of your <form>...</form>. Then simply change a couple of things. For example, have your <form>...</form> look something like: <form name="frmMain" action="sendemail.asp" method="post"> . . . . . . . . . [submit button] </form> Notice the sendemail.asp inside the *action* attribute. Once the user clicks on the [submit button] you'll send all the data of your <form>...</form> to the sendemail.asp page. Create a sendemail.asp page that retrieves the data from your <form>...</form> put them into variables. Then use an email component to send your email. Something like: <% Dim strFirstName Dim strEmailAddress Dim objMail strFirstName = Trim(Request.Form("txtFirstName")) strEmailAdress = Trim(Request.Form("txtEmailAddress")) 'Validation of the email address if you want! If strEmailAddress = "" Then Response.Write "Please enter an email address." Response.End 'or Response.Redirect End If Set objMail = Server.CreateObject("EasyMail.SMTP.5") If NOT IsObject(objMail) Then Response.Write "object not installed on the server, please install it and register it." Response.End End If objMail.LicenseKey = ... objMail.MailServer = ... objMail.Subject = ... objMail.BodyText = strFirstName & "<hr>" objMail.FromAddr = ... objMail.From = ... objMail.BodyFormat =... objMail.AddRecipient "", strEmailAdress , 1 objMail.Send Set objMail = nothing %> In this example, I'm using the component EasyMail to send an email. EasyMail is easy to use and you can add attachments if you want but that's another story... Check out the documentation *if you decide* to go with the EasyMail component to send your emails. Hope this helps! Sincerely Vlince |
|
#3
|
|||
|
|||
|
coor blimey gov' !!
I see what you mean, I asked too many questions and got myself confused! Right ok, what you put helped me out a great deal, but think Im going to stick with the basics Ok, this is what i have in my form field:: <form name="form1" method="post" action="AbigailC@***.co.uk"> with 3 text fields named : name, email and comments just for now all I want is for the details to be sent to my email , so I can open the email and see the details filled in from the form, for some reason its not letting me see it?? if u can help that would be brilliant, please dont give up on me!! ![]() |
|
#4
|
|||
|
|||
|
Ok try this *simple* asp page!
-------------------------------------------------------------------------- <%@ Language=VBScript %> <html> <head> </head> <body> <form method="post" action="mailto:test@test.com" enctype="text/plain"> <input type=text name=your_comments> <input type=submit value="Submit Your Comments"> </form> </body> </html> -------------------------------------------------------------------------- Notice the mailto: inside the *action* attribute Also notice the *enctype* attribute. Hope this helps! Sincerely Vlince |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > help with form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|