sMall!Girl Posted April 16, 2008 Share Posted April 16, 2008 Plz help me in solving this issue i want to send data into database and send it by email in the same time (with attachment) any body can give me asp code for that>>>>>>>>>>>>>>> plz urgentthanks in adavce :)i know there is spelling mistake in the title Link to comment Share on other sites More sharing options...
sMall!Girl Posted April 16, 2008 Author Share Posted April 16, 2008 no body replied on my question Link to comment Share on other sites More sharing options...
Synook Posted April 16, 2008 Share Posted April 16, 2008 Don't panic, this is a forum, not a chat room. Expect to wait up to a day (because various people live in various parts of the world and come on a different times, and various people know various things).To answer your question, you can both query a database and send a mail on one page. If you already know how to do both these things, then just stick one procedure underneath the other.How much of ASP do you know? Link to comment Share on other sites More sharing options...
sMall!Girl Posted April 16, 2008 Author Share Posted April 16, 2008 Don't panic, this is a forum, not a chat room. Expect to wait up to a day (because various people live in various parts of the world and come on a different times, and various people know various things).To answer your question, you can both query a database and send a mail on one page. If you already know how to do both these things, then just stick one procedure underneath the other.How much of ASP do you know?thnx i can say that i am a beginneri have wrote this code<% if request.Form("submit")<>"" then textfield12=request.Form("textfield12") textfield13=request.Form("textfield13") textfield14=request.Form("textfield14") textfield15=request.Form("textfield15") textfield16=request.Form("textfield16") textfield17=request.Form("textfield17") textfield18=request.Form("textfield18") rsource=request.Form("rsource") sFile=request("hCVdoc1") objconn.open dbConnection str = "insert into prevent (textfield12,textfield13,textfield14,textfield15,textfield16,textfield17,textfield18,sFile) values (" & makeSQLStr(textfield12) & ","& makeSQLStr(textfield13) & "," & makeSQLStr(textfield14)&"," & makeSQLStr(textfield15) &"," & makeSQLStr(textfield16) &"," & makeSQLStr(textfield17) &"," & makeSQLStr(textfield18) &","& sFile &")" 'response.write str 'response.end objconn.Execute(str) response.redirect("testform2.asp") end if %>but i couldn't save the attachment in the databasein another file i have wrote this code for sending the attachment by email:<%'NOTE - YOU MUST HAVE VBSCRIPT v5.0 INSTALLED ON YOUR WEB SERVER' FOR THIS LIBRARY TO FUNCTION CORRECTLY. YOU CAN OBTAIN IT' FREE FROM MICROSOFT WHEN YOU INSTALL INTERNET EXPLORER 5.0' OR LATER.' Create the FileUploaderDim Uploader, File,NewFN,sPathSet Uploader = New FileUploader' This starts the upload processUploader.Upload()'******************************************' Use [FileUploader object].Form to access ' additional form variables submitted with' the file upload(s). (used below)'******************************************' Check if any files were uploadedIf Uploader.Files.Count = 0 Then 'Response.Write "File(s) not uploaded."Else ' Loop through the uploaded files For Each File In Uploader.Files.Items ' Save the file File.SaveToDisk server.MapPath("files/") NewFN=File.FileName 'REsponse.Write(newfn) 'response.end() sPath=server.MapPath("files") ' Output the file details to the browser Response.Write "File Uploaded: " & File.FileName & "<br>" Response.Write "Size: " & File.FileSize & " bytes<br>" Response.Write "Type: " & File.ContentType & "<br><br>" NextEnd Ifdim str,textfield,textfield2,textfield3,textfield4,textfield5,textfield6,textfield7,textfield8txtdate=now()rsource=Uploader.form("rsource")textfield=Uploader.form("textfield")textfield2=Uploader.form("textfield2")textfield3=Uploader.form("textfield3")textfield4=Uploader.form("textfield4")textfield5=Uploader.form("textfield5")textfield6=Uploader.form("textfield6")textfield7=Uploader.form("textfield7")textfield8=Uploader.form("textfield8")'str=""str="<html><head><meta http-equiv='Content-Type' content='text/html; charset=windows-1256'/></head><body>" str=str + "<table align='center' cellpadding='0' cellspacing='0' dir='rtl'>"str=str + "</tr>"str=str + "</table></body></html>"i have wrote all the code for the filedsdim MyMsg MyMsg=str'response.Write(str)'response.End Dim ObjSendMailSet ObjSendMail = CreateObject("CDO.Message") 'configuration of smtp serverObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.mail.com"'ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the 'connection (True or False)ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60ObjSendMail.Configuration.Fields.UpdateObjSendMail.From ="real@yahoo.com"ObjSendMail.To ="real@yahoo.com"'ObjSendMail.cc ="real@yahoo.com"ObjSendMail.Subject = "Contact Us"ObjSendMail.HTMLBody = str'ObjSendMail.Send'Set ObjSendMail = Nothing 'sendAtemail.AttachFile (NewFN) if trim(NewFN) <> "" then ObjSendMail.AddAttachment(spath & "\" & NewFN) end if Link to comment Share on other sites More sharing options...
justsomeguy Posted April 16, 2008 Share Posted April 16, 2008 sFile=request("hCVdoc1")What is hCVdoc1? Is that a file that someone uploaded through the form? Link to comment Share on other sites More sharing options...
sMall!Girl Posted April 17, 2008 Author Share Posted April 17, 2008 sFile=request("hCVdoc1")What is hCVdoc1? Is that a file that someone uploaded through the form?first thanks for your replayexactly as you said the file which i will upload through the form will hold this name <INPUT TYPE=FILE NAME="hCVdoc1"> Link to comment Share on other sites More sharing options...
justsomeguy Posted April 17, 2008 Share Posted April 17, 2008 The first code you posted isn't going to work for uploaded files, those are treated different then other form elements. The second code you posted looks like it's trying to use a file upload component to save the uploaded file. You need to use the upload component to save the file, get the filename, and then you can store the filename in the database. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.